Home > classes > @ao > display.m

display

PURPOSE ^

DISPLAY implement terminal display for analysis object.

SYNOPSIS ^

function txt = display(ao, varargin)

DESCRIPTION ^

 DISPLAY implement terminal display for analysis object.

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

 DESCRIPTION: DISPLAY implement terminal display for analysis object.

 CALL:        txt = display(ao)
              ao                     % without a semicolon

 VERSION:     $Id: display.m,v 1.18 2008/02/23 18:07:18 hewitson Exp $

 HISTORY:     31-01-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function txt = display(ao, varargin)
0002 % DISPLAY implement terminal display for analysis object.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: DISPLAY implement terminal display for analysis object.
0007 %
0008 % CALL:        txt = display(ao)
0009 %              ao                     % without a semicolon
0010 %
0011 % VERSION:     $Id: display.m,v 1.18 2008/02/23 18:07:18 hewitson Exp $
0012 %
0013 % HISTORY:     31-01-2007 M Hewitson
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 VERSION  = '$Id: display.m,v 1.18 2008/02/23 18:07:18 hewitson Exp $';
0019 CATEGORY = 'Output';
0020 
0021 %% Check if this is a call for parameters
0022 if nargin == 2
0023   if isa(ao, 'ao') && ischar(varargin{1})
0024     in = char(varargin{1});
0025     if strcmp(in, 'Params')
0026       txt = plist();
0027       return
0028     elseif strcmp(in, 'Version')
0029       txt = VERSION;
0030       return
0031     elseif strcmp(in, 'Category')
0032       txt = CATEGORY;
0033       return
0034     end
0035   end
0036 end
0037 
0038 txt = {};
0039 
0040 for i=1:numel(ao)
0041   a = ao(i);
0042   data   = get(a, 'data');
0043   dinfo  = whos('data');
0044   hist   = get(a, 'hist');
0045   hinfo  = whos('hist');
0046 
0047   if nargin ~= length(ao)
0048     banner_start = sprintf('----------- ao %02d -----------', i);
0049   else
0050     banner_start = sprintf('----------- ao: %s -----------', inputname(i));
0051   end
0052 
0053   txt{end+1} = banner_start;
0054   txt{end+1} = ' ';
0055   txt{end+1} = sprintf('       name:  %s', get(a, 'name'));
0056   txt{end+1} = sprintf(' provenance:  %s', char(get(a, 'provenance')));
0057   txt{end+1} = sprintf('description:  %s', char(get(a, 'description')));
0058   if isa(data, 'cell')
0059     txt{end+1} = sprintf('       data:  None');
0060   else
0061     mi = min(5,length(data.y));
0062     dtxt = sprintf('       data:  %s / %s [%dx%d] |', ...
0063                  dinfo.class, get(data, 'name'), ...
0064                  size(data.y,1), ...
0065                  size(data.y,2));
0066     for j=1:mi
0067       if length(data.x) == length(data.y)
0068         dtxt = [dtxt sprintf(' (%g,%g)', data.x(j), data.y(j))];
0069       else
0070         dtxt = [dtxt sprintf(' %g', data.y(j))];
0071       end
0072     end
0073     if mi < length(data.y)
0074       dtxt = [dtxt ' ...'];
0075     end
0076     txt{end+1} = dtxt;
0077   end
0078   if isa(hist, 'cell')
0079     txt{end+1} = sprintf('       hist:  None');
0080   else
0081     txt{end+1} = sprintf('       hist:  %s / %s / %s', hinfo.class, get(hist, 'name'), get(hist, 'version'));
0082   end
0083   txt{end+1} = sprintf('  mfilename:  %s', a.mfilename);
0084   txt{end+1} = sprintf('mdlfilename:  %s', a.mdlfilename);
0085 
0086   banner_end(1:length(banner_start)) = '-';
0087   txt{end+1} = banner_end;
0088 
0089   txt{end+1} = ' ';
0090   txt{end+1} = ' ';
0091 end
0092 
0093 if nargout == 0
0094   for ii=1:length(txt)
0095     disp(txt{ii});
0096   end
0097 end
0098 
0099 % END

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003