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.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $ HISTORY: 02-04-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $ 0012 % 0013 % HISTORY: 02-04-2007 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 VERSION = '$Id: string.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $'; 0019 CATEGORY = 'Helper'; 0020 0021 % Check if this is a call for parameters or for the cvs-version number 0022 if nargin == 2 0023 if isa(p, 'pzmodel') && ischar(varargin{1}) 0024 in = char(varargin{1}); 0025 if strcmp(in, 'Params') 0026 cmd = plist(); 0027 return 0028 elseif strcmp(in, 'Version') 0029 cmd = VERSION; 0030 return 0031 elseif strcmp(in, 'Category') 0032 cmd = CATEGORY; 0033 return 0034 end 0035 end 0036 end 0037 0038 if ~isempty(p.plist) 0039 cmd = sprintf('pzmodel(%s)', string(p.plist)); 0040 else 0041 pl = plist(); 0042 fields = fieldnames(p); 0043 for ii = 1:length(fields) 0044 field = fields{ii}; 0045 pl = append(pl, field, p.(field)); 0046 end 0047 0048 cmd = ['pzmodel(' string(pl) ')']; 0049 end 0050 0051 % END