Home > functions > internal > xp_libraries > xp_PlotData.m

xp_PlotData

PURPOSE ^

xp must be 1x1 (e.g. 0 dimensional)

SYNOPSIS ^

function hxp = xp_PlotData (xp, op)

DESCRIPTION ^

 xp must be 1x1 (e.g. 0 dimensional)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 
0003 function hxp = xp_PlotData (xp, op)
0004     % xp must be 1x1 (e.g. 0 dimensional)
0005     
0006     hxp = struct;
0007     
0008     if nargin < 2
0009         op = struct;
0010     end
0011     
0012     if isempty(op); op = struct; end;
0013     
0014     op = struct_addDef(op,'args',{});
0015     
0016     xlims = op.xlims;
0017     ylims = op.ylims;
0018 
0019     % Squeeze out any 1D placeholder axes ("Dim X"). These can be created
0020     % by the unpacking operation above.
0021     xp = xp.squeezeRegexp('Dim');
0022     
0023     % Convert xp to DynaSim data struct
0024     data = dsMdd2ds(xp);
0025     
0026     % Remove NaNs introduced due to packing
0027     for i = 1:length(data)
0028         labels = data(i).labels;
0029         labels_sans_time = labels(~strcmp(labels,'time'));
0030 
0031         for j = 1:length(labels_sans_time)
0032             d = data(i).(labels_sans_time{j});
0033             ind = all(~isnan(d),1);
0034             d=d(:,ind);
0035             data(i).(labels_sans_time{j}) = d;
0036         end
0037     end
0038     
0039     % Feed into original PlotData command, making sure it doesn't generate
0040     % new figures (rather, should produce it in the current subplot)
0041     
0042     % Hack to get working with dsPlot bug being unable to accept strings
0043     % right now. This issue results around line 200 (seems to have to
0044     % dowith the new code for detecting co-varied params in dsPlot).
0045     if isfield(data(1),'varied')
0046         varied = data(1).varied;
0047         for i = 1:length(data);
0048             for j = 1:length(varied)
0049                 if ischar(data(i).(varied{j}))
0050                     temp = data(i).(varied{j});
0051                     ind = strfind(temp,'_');
0052                     temp = str2num(temp(1:ind-1));
0053                     if isempty(temp); temp = 0; end
0054                     data(i).(varied{j}) = temp;
0055                 end
0056             end
0057         end
0058     end
0059     hxp.hcurr = dsPlot(data,op.args{:},'lock_gca',true);
0060     
0061     if ~isempty(xlims); xlim(xlims); end
0062     if ~isempty(ylims); ylim(ylims); end
0063 
0064 end
0065 
0066

Generated on Tue 12-Dec-2017 11:32:10 by m2html © 2005