Home > classes > @param > display.m

display

PURPOSE ^

DISPLAY display a parameter

SYNOPSIS ^

function txt = display(p)

DESCRIPTION ^

 DISPLAY display a parameter

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

 DESCRIPTION: DISPLAY display a parameter

 VERSION: $Id: display.m,v 1.12 2007/06/29 08:52:16 ingo Exp $

 HISTORY: 30-01-2007 M Hewitson
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function txt = display(p)
0002 % DISPLAY display a parameter
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: DISPLAY display a parameter
0007 %
0008 % VERSION: $Id: display.m,v 1.12 2007/06/29 08:52:16 ingo Exp $
0009 %
0010 % HISTORY: 30-01-2007 M Hewitson
0011 %             Creation
0012 %
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 
0015 txt = {};
0016 
0017 for i=1:length(p)
0018   banner = sprintf('---- param %d ----', i);
0019   txt{end+1} = banner;
0020 
0021   % get key and value
0022   name = get(p(i), 'key');
0023   v    = get(p(i), 'val');
0024 
0025   % convert value for printing
0026   if ischar(v)
0027     sval = v;
0028   elseif isnumeric(v)
0029     sval = '';
0030     for j=1:min(length(v), 10)
0031       sval = [sval sprintf('%g ', v(j))];
0032     end
0033     if length(v) > 10
0034       sval = [sval '...'];
0035     end
0036   elseif isa(v, 'specwin');
0037     sval = char(v);
0038   elseif isa(v, 'miir');
0039     sval = char(v);
0040   elseif isa(v, 'mfir');
0041     sval = char(v);
0042   %!!!!!!!!!!!!!
0043   % Here I'm assuming there is a name field in the structure
0044   % - what else could we display here??
0045   %
0046   elseif isstruct(v)
0047     sval = v.name;
0048   elseif isa(v, 'ao') || isa(v, 'fsdata') || isa(v, 'tsdata') || isa(v, 'cdata')
0049     vinfo = whos('v');
0050     sval = vinfo.class;
0051   elseif isa(v, 'pole') || isa(v, 'zero') || isa(v, 'pzmodel')
0052     sval = '';
0053     for j=1:length(v)
0054       sval = [sval ' ' char(v(j))];
0055     end
0056   elseif iscell(v)
0057     sval = '';
0058     for ii = 1:length(v)
0059       sval = [sval '''' v{ii} ''' '];
0060     end
0061   else
0062     error('### parameter has unknown type')
0063   end
0064 
0065   % display
0066   txt{end+1} = sprintf('key: %s\nval: %s', name, deblank(sval));
0067 
0068   banner_end(1:length(banner)) = '-';
0069   txt{end+1} = banner_end;
0070 
0071 end
0072 
0073 if nargout == 0
0074   for ii=1:length(txt)
0075     disp(txt{ii});
0076   end
0077 end
0078 
0079 
0080

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