Home > classes > @plist > string.m

string

PURPOSE ^

STRING converts a plist object to a command string which will recreate

SYNOPSIS ^

function pstr = string(pl)

DESCRIPTION ^

 STRING converts a plist object to a command string which will recreate
 the plist object.
 
 usage: cmd = string(pl)
 
 M Hewitson 29-03-07
 
 $Id: string.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 = string(pl)
0002 
0003 % STRING converts a plist object to a command string which will recreate
0004 % the plist object.
0005 %
0006 % usage: cmd = string(pl)
0007 %
0008 % M Hewitson 29-03-07
0009 %
0010 % $Id: string.html,v 1.1 2007/06/08 14:15:06 hewitson Exp $
0011 %
0012 
0013 np   = length(pl.params);
0014 pstr = '';
0015 if np > 0
0016   pstr = ['plist(['];
0017   for j=1:np
0018     p = pl.params(j);
0019     if ischar(p.val)
0020       pstr = [pstr 'param('''  p.key ''', ''' char(p.val) ''') '];
0021     elseif isnumeric(p.val)
0022       pstr = [pstr 'param('''  p.key ''', [' num2str(p.val) ']) '];
0023     elseif isa(p.val, 'specwin')
0024       pstr = [pstr 'param(''' p.key ''', ' string(p.val) ') '];
0025     elseif isa(p.val, 'miir')
0026       pstr = [pstr 'param(''' p.key ''', ' string(p.val) ') '];
0027     elseif isa(p.val, 'pole') || isa(p.val, 'zero') || isa(p.val, 'pzmodel')
0028       pstr = [pstr 'param(''' p.key ''', ' string(p.val) ') '];
0029     else
0030       warning('!!! unknown parameter type. Can''t convert to string.');
0031     end
0032   end
0033 
0034   % close bracket
0035   pstr = [pstr '])'];
0036 end
0037 
0038 % END

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