0001 function varargout = stairs(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 VERSION = '$Id: stairs.m,v 1.5 2007/10/24 17:35:28 ingo Exp $';
0030
0031
0032 if nargin == 2
0033 if isa(varargin{1}, 'ao') && ischar(varargin{2})
0034 in = char(varargin{2});
0035 if strcmp(in, 'Params')
0036 varargout{1} = getDefaultPL();
0037 return
0038 elseif strcmp(in, 'Version')
0039 varargout{1} = VERSION;
0040 return
0041 end
0042 end
0043 end
0044
0045
0046
0047
0048 invars = {};
0049 as = [];
0050 ps = [];
0051 Nbins = -1;
0052 Xbins = [];
0053 for j=1:nargin
0054 if isa(varargin{j}, 'ao')
0055 invars = [invars cellstr(inputname(j))];
0056 end
0057 if isa(varargin{j}, 'ao')
0058 as = [as varargin{j}];
0059 end
0060 if isa(varargin{j}, 'plist')
0061 ps = [ps varargin{j}];
0062 end
0063 if isnumeric(varargin{j})
0064 if length(varargin{j}) > 1
0065 Xbins = varargin{j};
0066 else
0067 Nbins = varargin{j};
0068 end
0069 end
0070 end
0071
0072
0073 if isa(ps, 'plist')
0074 pl = combine(ps, getDefaultPL());
0075 else
0076 pl = getDefaultPL();
0077 end
0078
0079
0080 if ~isempty(Xbins)
0081 pl = set(pl, 'X', Xbins);
0082 end
0083
0084
0085 if Nbins>0
0086 pl = set(pl, 'N', Nbins);
0087 end
0088
0089
0090
0091
0092
0093 colors = getappdata(0, 'ltpda_default_plot_colors');
0094
0095
0096
0097
0098 handles = [];
0099
0100 for j=1:numel(as)
0101 a = as(j);
0102 legendStr = [];
0103
0104
0105 [x,y] = get_xy_values(a.data);
0106 if isempty(x)
0107 x = 1:length(y);
0108 end
0109
0110
0111 col = colors{mod(j-1,length(colors))+1};
0112 h = stairs(x,y);
0113 legendStr = [legendStr cellstr(sprintf('%s', ltpda_label(a.name)))];
0114 set(h, 'Color', col);
0115 title('Stair plot');
0116 grid on;
0117 legend(legendStr)
0118 ylabel(sprintf('Y [%s]', a.data.yunits));
0119 xlabel(sprintf('X [%s]', a.data.xunits));
0120 hold on;
0121
0122
0123 handles = [handles h];
0124
0125 end
0126
0127
0128 if nargout == 1
0129 varargout{1} = handles;
0130 end
0131
0132
0133 function plo = getDefaultPL()
0134
0135 plo = plist();
0136
0137
0138
0139
0140