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.4 2007/07/18 13:58:45 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.4 2007/07/18 13:58:45 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 'param('''  p.key ''', ''' char(p.val) ''') '];
0026     elseif isnumeric(p.val)
0027       pstr = [pstr 'param('''  p.key ''', [' num2str(p.val) ']) '];
0028     elseif isa(p.val, 'specwin')
0029       pstr = [pstr 'param(''' p.key ''', ' string(p.val) ') '];
0030     elseif isa(p.val, 'miir')
0031       pstr = [pstr 'param(''' p.key ''', ' string(p.val) ') '];
0032     elseif isa(p.val, 'pole') || isa(p.val, 'zero') || isa(p.val, 'pzmodel')
0033       pstr = [pstr 'param(''' p.key ''', ' string(p.val) ') '];
0034     else
0035       warning('!!! unknown parameter type. Can''t convert to string.');
0036     end
0037   end
0038 
0039   % close bracket
0040   pstr = [pstr '])'];
0041 end
0042 
0043 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003