0001 function txt = display(pls, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 VERSION = '$Id: display.html,v 1.14 2008/03/31 10:27:41 hewitson Exp $';
0016 CATEGORY = 'Output';
0017
0018
0019 if nargin == 2
0020 if isa(pls, 'plist') && ischar(varargin{1})
0021 in = char(varargin{1});
0022 if strcmp(in, 'Params')
0023 txt = plist();
0024 return
0025 elseif strcmp(in, 'Version')
0026 txt = VERSION;
0027 return
0028 elseif strcmp(in, 'Category')
0029 txt = CATEGORY;
0030 return
0031 end
0032 end
0033 end
0034
0035 txt = {};
0036
0037 for ii=1:numel(pls)
0038 pl = pls(ii);
0039 n = nparams(pl);
0040
0041 banner_start = sprintf('----------- plist %02d -----------', ii);
0042 txt{end+1} = banner_start;
0043
0044 txt{end+1} = sprintf('n params: %d', n);
0045 params = get(pl, 'params');
0046 if n>0
0047 txt{end+1} = display(params);
0048 end
0049
0050 txt = single_cell(txt);
0051
0052 banner_end(1:length(banner_start)) = '-';
0053 txt{end+1} = banner_end;
0054
0055 end
0056
0057 if nargout == 0
0058 for ii=1:length(txt)
0059 disp(txt{ii});
0060 end
0061 end
0062
0063
0064
0065
0066 function new_txt = single_cell(txt_field)
0067
0068 new_txt = {};
0069 for ii=1:length(txt_field)
0070 if iscell(txt_field{ii})
0071 hh = single_cell(txt_field{ii});
0072 new_txt(end+1:end+length(hh)) = hh(1:end);
0073 else
0074 new_txt{end+1} = txt_field{ii};
0075 end
0076 end
0077
0078