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