Home > classes > @history > display.m

display

PURPOSE ^

DISPLAY implement terminal display for history object.

SYNOPSIS ^

function txt = display(hists)

DESCRIPTION ^

 DISPLAY implement terminal display for history object.


 M Hewitson 30-01-07

 $Id: display.m,v 1.5 2007/06/18 16:41:21 ingo Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function txt = display(hists)
0002 
0003 % DISPLAY implement terminal display for history object.
0004 %
0005 %
0006 % M Hewitson 30-01-07
0007 %
0008 % $Id: display.m,v 1.5 2007/06/18 16:41:21 ingo Exp $
0009 %
0010 
0011 txt = {};
0012 
0013 for i=1:length(hists)
0014   h = hists(i);
0015   banner = sprintf('-------- %s / %s / %d ------------', get(h, 'name'), get(h, 'version'), get(h, 'n'));
0016   txt{end+1} = banner;
0017 
0018   txt{end+1} = ' ';
0019   txt{end+1} = sprintf('created: %s', datestr(h.created,31));
0020 
0021   % show input vars
0022   txt{end+1} = ['Inputs: ' get(h, 'invars')];
0023 
0024   % show parameter list
0025   txt{end+1} = 'Parameters';
0026   txt{end+1} = '----------';
0027   plist = get(h, 'plist');
0028   if ~isempty(plist)
0029     txt{end+1} = display(plist);
0030   end
0031 
0032   txt{end+1} = ' ';
0033 
0034   txt{end+1} = 'Histories';
0035   txt{end+1} = '---------';
0036 
0037   % show input histories
0038   inhists = get(h, 'inhists');
0039   nhists = length(inhists);
0040   txt{end+1} = sprintf('n input histories: %d', nhists);
0041   if nhists > 0
0042     txt{end+1} = display(inhists);
0043   end
0044 
0045   txt{end+1} = ' ';
0046 
0047   bannerEnd = [];
0048   while length(bannerEnd) < length(banner)
0049     bannerEnd = [bannerEnd '-'];
0050   end
0051   txt{end+1} = bannerEnd;
0052 
0053   txt{end+1} = ' ';
0054   txt{end+1} = ' ';
0055 end
0056 
0057 txt = single_cell(txt);
0058 
0059 if nargout == 0
0060   for ii=1:length(txt)
0061     disp(txt{ii});
0062   end
0063 end
0064 
0065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0066 
0067 function new_txt = single_cell(txt_field)
0068 
0069 new_txt = {};
0070 for ii=1:length(txt_field)
0071   if iscell(txt_field{ii})
0072     hh = single_cell(txt_field{ii});
0073     new_txt(end+1:end+length(hh)) = hh(1:end);
0074   else
0075     new_txt{end+1} = txt_field{ii};
0076   end
0077 end
0078 
0079 % END

Generated on Mon 02-Jul-2007 12:19:41 by m2html © 2003