Home > classes > @plist > string.m

string

PURPOSE ^

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

SYNOPSIS ^

function pstr = string(pl)

DESCRIPTION ^

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

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

 DESCRIPTION: STRING converts a plist object to a command string which will
              recreate the plist object.

 CALL:        cmd = string(pl)

 VERSION:     $Id: string.m,v 1.5 2007/10/22 12:03:39 ingo Exp $

 HISTORY:     29-03-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pstr = string(pl)
0002 % STRING converts a plist object to a command string which will recreate the plist object.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: STRING converts a plist object to a command string which will
0007 %              recreate the plist object.
0008 %
0009 % CALL:        cmd = string(pl)
0010 %
0011 % VERSION:     $Id: string.m,v 1.5 2007/10/22 12:03:39 ingo Exp $
0012 %
0013 % HISTORY:     29-03-2007 M Hewitson
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 np   = length(pl.params);
0019 pstr = '';
0020 if np > 0
0021   pstr = ['plist('];
0022   for j=1:np
0023     p = pl.params(j);
0024     if ischar(p.val)
0025       pstr = [pstr ''''  p.key ''', ''' char(p.val) ''', '];
0026     elseif isnumeric(p.val)
0027       pstr = [pstr ''''  p.key ''', [' num2str(p.val) '], '];
0028     elseif isa(p.val, 'specwin')
0029       pstr = [pstr '''' p.key ''', ' string(p.val) ', '];
0030     elseif isa(p.val, 'miir')
0031       pstr = [pstr '''' p.key ''', ' string(p.val) ', '];
0032     elseif isa(p.val, 'pole') || isa(p.val, 'zero') || isa(p.val, 'pzmodel')
0033       pstr = [pstr '''' p.key ''', ' string(p.val) ', '];
0034     elseif isa(p.val, 'time')
0035       pstr = [pstr '''' p.key ''', ' string(p.val) ', '];      
0036     else
0037       warning('!!! unknown parameter type. Can''t convert to string.');
0038     end
0039   end
0040 
0041   % close bracket
0042   if ~isempty(pstr)
0043     pstr = pstr(1:end-2);
0044   end
0045   pstr = [pstr ')'];
0046 end
0047 
0048 
0049 
0050 % END

Generated on Thu 01-Nov-2007 09:42:34 by m2html © 2003