0001 function txt = display(hists, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 VERSION = '$Id: display.m,v 1.10 2008/02/12 22:30:27 hewitson Exp $';
0022 CATEGORY = 'Output';
0023
0024
0025 if nargin == 2
0026 if isa(hists, 'history') && ischar(varargin{1})
0027 in = char(varargin{1});
0028 if strcmp(in, 'Params')
0029 txt = plist();
0030 return
0031 elseif strcmp(in, 'Version')
0032 txt = VERSION;
0033 return
0034 elseif strcmp(in, 'Category')
0035 txt = CATEGORY;
0036 return
0037 end
0038 end
0039 end
0040
0041 txt = {};
0042
0043 for i=1:numel(hists)
0044 h = hists(i);
0045 banner = sprintf('-------- %s / %s / %d ------------', get(h, 'name'), ...
0046 get(h, 'version'), ...
0047 get(h, 'n'));
0048 txt{end+1} = banner;
0049
0050 txt{end+1} = ' ';
0051 txt{end+1} = sprintf('created: %s', char(h.created));
0052
0053
0054 txt{end+1} = ['Inputs: ' get(h, 'invars')];
0055
0056
0057 txt{end+1} = 'Parameters';
0058 txt{end+1} = '----------';
0059 pl = get(h, 'plist');
0060 if ~isempty(pl)
0061 txt{end+1} = display(pl);
0062 end
0063
0064 txt{end+1} = ' ';
0065
0066 txt{end+1} = 'Histories';
0067 txt{end+1} = '---------';
0068
0069
0070 inhists = get(h, 'inhists');
0071 nhists = length(inhists);
0072 txt{end+1} = sprintf('n input histories: %d', nhists);
0073 if nhists > 0
0074 txt{end+1} = display(inhists);
0075 end
0076
0077 txt{end+1} = ' ';
0078
0079 bannerEnd = [];
0080 while length(bannerEnd) < length(banner)
0081 bannerEnd = [bannerEnd '-'];
0082 end
0083 txt{end+1} = bannerEnd;
0084
0085 txt{end+1} = ' ';
0086 txt{end+1} = ' ';
0087 end
0088
0089 txt = single_cell(txt);
0090
0091 if nargout == 0
0092 for ii=1:length(txt)
0093 disp(txt{ii});
0094 end
0095 end
0096
0097
0098
0099 function new_txt = single_cell(txt_field)
0100
0101 new_txt = {};
0102 for ii=1:length(txt_field)
0103 if iscell(txt_field{ii})
0104 hh = single_cell(txt_field{ii});
0105 new_txt(end+1:end+length(hh)) = hh(1:end);
0106 else
0107 new_txt{end+1} = txt_field{ii};
0108 end
0109 end
0110
0111