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 ALGONAME = mfilename;
0026 VERSION = '$Id: stairs.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $';
0027
0028
0029 invars = {};
0030 as = [];
0031 ps = [];
0032 Nbins = -1;
0033 Xbins = [];
0034 for j=1:nargin
0035 if isa(varargin{j}, 'ao')
0036 invars = [invars cellstr(inputname(j))];
0037 end
0038 if isa(varargin{j}, 'ao')
0039 as = [as varargin{j}];
0040 end
0041 if isa(varargin{j}, 'plist')
0042 ps = [ps varargin{j}];
0043 end
0044 if isnumeric(varargin{j})
0045 if length(varargin{j}) > 1
0046 Xbins = varargin{j};
0047 else
0048 Nbins = varargin{j};
0049 end
0050 end
0051 end
0052
0053
0054 if isa(ps, 'plist')
0055 pl = combine(ps, getDefaultPL());
0056 else
0057 pl = getDefaultPL();
0058 end
0059
0060
0061 if ~isempty(Xbins)
0062 pl = set(pl, 'X', Xbins);
0063 end
0064
0065
0066 if Nbins>0
0067 pl = set(pl, 'N', Nbins);
0068 end
0069
0070
0071 na = length(as);
0072
0073
0074
0075 N = find(pl, 'N');
0076 X = find(pl, 'X');
0077
0078 colors = {[0.8 0.2 0.2], [0.2 0.2 0.8], [0.2 0.9 0.2],...
0079 [0.37 0.9 0.83], [0.888 0.163 0.9], [0 0 0], ...
0080 [0 207 255]/255, [255 128 0]/255, [143 0 0]/255,...
0081 [255 207 0]/255, [0.9 0.266 0.593]};
0082
0083
0084
0085
0086 handles = [];
0087
0088 for j=1:na
0089 a = as(j);
0090 legendStr = [];
0091
0092
0093 [x,y] = getAOdata(a);
0094 if isempty(x)
0095 x = 1:length(y);
0096 end
0097
0098
0099 col = colors{mod(j-1,length(colors))+1};
0100 h = stairs(x,y);
0101 legendStr = [legendStr cellstr(sprintf('%s', ltpda_label(a.name)))];
0102 set(h, 'Color', col);
0103 title('Stair plot');
0104 grid on;
0105 legend(legendStr)
0106 ylabel(sprintf('Y [%s]', a.data.yunits));
0107 xlabel(sprintf('X [%s]', a.data.xunits));
0108 hold on;
0109
0110
0111 handles = [handles h];
0112
0113 end
0114
0115
0116 if nargout == 1
0117 varargout{1} = handles;
0118 end
0119
0120
0121 function plo = getDefaultPL()
0122
0123 disp('* creating default plist...');
0124 plo = plist();
0125 disp('* done.');
0126
0127
0128