Home > classes > @cdata > display.m

display

PURPOSE ^

DISPLAY implement terminal display for cdata object.

SYNOPSIS ^

function txt = display(cdatas, varargin)

DESCRIPTION ^

 DISPLAY implement terminal display for cdata object.

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

 DESCRIPTION: DISPLAY implement terminal display for cdata object.

 VERSION: $Id: display.m,v 1.7 2008/02/12 19:54:05 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(cdatas, varargin)
0002 % DISPLAY implement terminal display for cdata object.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: DISPLAY implement terminal display for cdata object.
0007 %
0008 % VERSION: $Id: display.m,v 1.7 2008/02/12 19:54:05 hewitson Exp $
0009 %
0010 % HISTORY: 31-01-2007 M Hewitson
0011 %             Creation
0012 %
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 
0015 VERSION  = '$Id: display.m,v 1.7 2008/02/12 19:54:05 hewitson Exp $';
0016 CATEGORY = 'Output';
0017 
0018 % Check if this is a call for parameters
0019 if nargin == 2
0020   if isa(cdatas, 'cdata') && ischar(varargin{1})
0021     in = char(varargin{1});
0022     if strcmp(in, 'Params')
0023       txt = plist();
0024       return
0025     elseif strcmp(in, 'Version')
0026       txt = VERSION;
0027       return
0028     elseif strcmp(in, 'Category')
0029       txt = CATEGORY;
0030       return
0031     end
0032   end
0033 end
0034 
0035 txt = {};
0036 
0037 for i=1:numel(cdatas)
0038   c = cdatas(i);
0039   banner = sprintf('-------- cdata %02d ------------', i);
0040   txt{end+1} = banner;
0041 
0042   txt{end+1} = ' ';
0043 
0044   y     = get(c, 'y');
0045   xinfo = whos('y');
0046 
0047   txt{end+1} = sprintf('  name:  %s', get(c, 'name'));
0048   txt{end+1} = sprintf('  y:  [%dx%d], %s', xinfo.size(1), xinfo.size(2), xinfo.class);
0049   x = get(c, 'x');
0050   tstr = '';
0051   for j=1:length(x)
0052     if j < 10
0053       tstr = [tstr ' ' char(x{j})];
0054     else
0055       tstr = [deblank(tstr) '...'];
0056       break;
0057     end
0058   end
0059 
0060   txt{end+1} = ['  x: ' tstr];
0061 
0062   banner_end(1:length(banner)) = '-';
0063   txt{end+1} = banner_end;
0064 
0065   txt{end+1} = ' ';
0066   txt{end+1} = ' ';
0067 end
0068 
0069 if nargout == 0
0070   for ii=1:length(txt)
0071     disp(txt{ii});
0072   end
0073 end
0074 
0075 % END

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