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.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: DISPLAY implement terminal display for history object.

 CALL:        txt = display(history)

 INPUT:       history - history object

 OUTPUT:      txt     - cell array with strings to display the history object

 VERSION:     $Id: display.m,v 1.7 2007/07/30 12:18:28 ingo Exp $

 HISTORY:     30-01-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003