Home > classes > @plist > char.m

char

PURPOSE ^

CHAR convert a parameter list into a string.

SYNOPSIS ^

function pstr = char(pl)

DESCRIPTION ^

 CHAR convert a parameter list into a string.
 
 M Hewitson 04-02-07
 
 $Id: char.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 pstr = char(pl)
0002 
0003 % CHAR convert a parameter list into a string.
0004 %
0005 % M Hewitson 04-02-07
0006 %
0007 % $Id: char.html,v 1.1 2007/06/08 14:15:06 hewitson Exp $
0008 %
0009 
0010 np   = length(pl.params);
0011 pstr = '';
0012 if np > 0
0013   pstr = ['('];
0014   for j=1:np
0015     p = pl.params(j);
0016     if ischar(p.val)
0017       sval = char(p.val);
0018       if length(sval) >= 10
0019         sval = [sval(1:10) '...'];
0020       end
0021       pstr = [pstr p.key '=' sval ', '];
0022     elseif isnumeric(p.val)
0023       vals = p.val;
0024       ml   = min(10, length(vals));
0025       vals = reshape(vals(1:ml),1,ml);
0026       pstr = [pstr p.key '=' num2str(vals) ', '];
0027       if length(p.val) > 10
0028         pstr = [pstr '...'];
0029       end
0030     elseif isa(p.val, 'specwin')
0031       % display only the window name here
0032       w = p.val;
0033       pstr = [pstr p.key '=' w.name ', '];
0034     elseif isa(p.val, 'miir')
0035       f = p.val;
0036       if strcmp(get(f, 'infile'), '')
0037         pstr = [pstr p.key '=' get(f, 'name') ', '];
0038       else
0039         pstr = [pstr p.key '=' get(f, 'infile') ', '];
0040       end
0041     elseif isa(p.val, 'mfir')
0042       f = p.val;
0043       pstr = [pstr p.key '=' get(f, 'name') ', '];
0044     elseif isa(p.val, 'tsdata') || isa(p.val, 'fsdata') || isa(p.val, 'cdata')
0045       
0046       pstr = 'data';
0047         
0048     else
0049 %       warning('!!! unknown parameter type. Can''t convert to string.');
0050     end
0051   end
0052   % remove last ', '
0053   if length(pstr)>1
0054     pstr = pstr(1:end-2);
0055   end
0056   % close bracket
0057   pstr = [pstr ')'];
0058 end
0059 
0060 
0061 % END

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