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