Home > classes > @param > display.m

display

PURPOSE ^

DISPLAY display a parameter

SYNOPSIS ^

function display(p)

DESCRIPTION ^

 DISPLAY display a parameter
 
 M Hewitson 30-01-07
 
 $Id: display.html,v 1.1 2007/06/08 14:15:06 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function display(p)
0002 
0003 % DISPLAY display a parameter
0004 %
0005 % M Hewitson 30-01-07
0006 %
0007 % $Id: display.html,v 1.1 2007/06/08 14:15:06 hewitson Exp $
0008 %
0009 
0010 for i=1:length(p)
0011   banner = sprintf('---- param %d ----', i);
0012   disp(banner);
0013   
0014   % get key and value
0015   name = get(p(i), 'key');
0016   v    = get(p(i), 'val');
0017 
0018   % convert value for printing
0019   if ischar(v)
0020     sval = v;
0021   elseif isnumeric(v)
0022     sval = '';
0023     for j=1:min(length(v), 10)
0024       sval = [sval sprintf('%g ', v(j))];
0025     end
0026     if length(v) > 10
0027       sval = [sval '...'];
0028     end
0029   elseif isa(v, 'specwin');
0030     sval = char(v);
0031   elseif isa(v, 'miir');
0032     sval = char(v);
0033   elseif isa(v, 'mfir');
0034     sval = char(v);
0035   %!!!!!!!!!!!!!
0036   % Here I'm assuming there is a name field in the structure
0037   % - what else could we display here??
0038   %
0039   elseif isstruct(v) 
0040     sval = v.name;
0041   elseif isa(v, 'ao') || isa(v, 'fsdata') || isa(v, 'tsdata') || isa(v, 'cdata')
0042     vinfo = whos('v');
0043     sval = vinfo.class;
0044   elseif isa(v, 'pole') || isa(v, 'zero') || isa(v, 'pzmodel')
0045     sval = '';
0046     for j=1:length(v)
0047       sval = [sval ' ' char(v(j))];
0048     end
0049   else
0050     error('### parameter has unknown type')
0051   end
0052 
0053   % display
0054   disp(sprintf('key: %s\nval: %s', name, deblank(sval)))
0055 
0056   bannerEnd = [];
0057   while length(bannerEnd) < length(banner)
0058     bannerEnd = [bannerEnd '-'];
0059   end
0060   disp(bannerEnd);
0061   
0062 end
0063 
0064 
0065

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003