Home > classes > @zero > string.m

string

PURPOSE ^

STRING writes a command string that can be used to recreate the input zero object.

SYNOPSIS ^

function cmd = string(ps, varargin)

DESCRIPTION ^

 STRING writes a command string that can be used to recreate the input zero object.

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

 DESCRIPTION: STRING writes a command string that can be used to recreate the
              input zero object.

 CALL:        cmd = string (zero);

 VERSION:     $Id: string.m,v 1.5 2008/01/03 15:33:49 ingo Exp $

 HISTORY:     02-04-2007 Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cmd = string(ps, varargin)
0002 % STRING writes a command string that can be used to recreate the input zero object.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: STRING writes a command string that can be used to recreate the
0007 %              input zero object.
0008 %
0009 % CALL:        cmd = string (zero);
0010 %
0011 % VERSION:     $Id: string.m,v 1.5 2008/01/03 15:33:49 ingo Exp $
0012 %
0013 % HISTORY:     02-04-2007 Hewitson
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 VERSION = '$Id: string.m,v 1.5 2008/01/03 15:33:49 ingo Exp $';
0019 
0020 %%%%%   'Params' && 'Version' Call   %%%%%
0021 if nargin == 2
0022   if isa(ps, 'zero') && ischar(varargin{1})
0023     in = varargin{1};
0024     if strcmp(in, 'Params')
0025       cmd = plist();
0026       return
0027     elseif strcmp(in, 'Version')
0028       cmd = VERSION;
0029       return
0030     end
0031   end
0032 end
0033 
0034 cmd = '[';
0035 for j=1:length(ps)
0036   p = ps(j);
0037 
0038   pl = plist();
0039   fields = fieldnames(p);
0040   for ii = 1:length(fields)
0041     field = fields{ii};
0042     if strcmp(field, 'ri')
0043       % do not add this field to the parametr list
0044     else
0045       pl = append(pl, field, p.(field));
0046     end
0047   end
0048 
0049   cmd = [cmd ' zero(' string(pl) ')'];
0050 end
0051 cmd = [cmd ']'];
0052 
0053 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003