Home > classes > @pzmodel > string.m

string

PURPOSE ^

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

SYNOPSIS ^

function cmd = string(p, varargin)

DESCRIPTION ^

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

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

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

 CALL:        cmd = string(pzmodel)

 VERSION:     $Id: string.m,v 1.5 2008/01/08 14:57:07 ingo Exp $

 HISTORY:     02-04-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cmd = string(p, varargin)
0002 % STRING writes a command string that can be used to recreate the input pzmodel object.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: STRING writes a command string that can be used to recreate
0007 %              the input pzmodel object.
0008 %
0009 % CALL:        cmd = string(pzmodel)
0010 %
0011 % VERSION:     $Id: string.m,v 1.5 2008/01/08 14:57:07 ingo Exp $
0012 %
0013 % HISTORY:     02-04-2007 M Hewitson
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 VERSION = '$Id: string.m,v 1.5 2008/01/08 14:57:07 ingo Exp $';
0019 
0020 % Check if this is a call for parameters or for the cvs-version number
0021 if nargin == 2
0022   if isa(p, 'pzmodel') && ischar(varargin{1})
0023     in = char(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 pl = plist();
0035 fields = fieldnames(p);
0036 for ii = 1:length(fields)
0037   field = fields{ii};
0038   pl = append(pl, field, p.(field));
0039 end
0040 
0041 cmd = ['pzmodel(' string(pl) ')'];
0042 
0043 % END

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