STRING writes a command string that can be used to recreate the input Analysis object(s). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: STRING writes a command string that can be used to recreate the input Analysis object(s). CALL: cmd = string(a1) VERSION: $Id: string.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $ HISTORY: 29-03-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function cmd = string(varargin) 0002 % STRING writes a command string that can be used to recreate the input Analysis object(s). 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: STRING writes a command string that can be used to recreate the 0007 % input Analysis object(s). 0008 % 0009 % CALL: cmd = string(a1) 0010 % 0011 % VERSION: $Id: string.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $ 0012 % 0013 % HISTORY: 29-03-07 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 VERSION = ' $Id: string.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $'; 0019 CATEGORY = 'Helper'; 0020 0021 %%%%% 'Params' && 'Version' Call %%%%% 0022 if nargin == 2 0023 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0024 in = varargin{2}; 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 %% Process string 0039 as = varargin{1}; 0040 cmd = '['; 0041 0042 for j=1:length(as) 0043 a = as(j); 0044 0045 hist = get(a, 'hist'); 0046 pl = get(hist, 'plist'); 0047 0048 if isempty(pl) 0049 error('### this AO was not created with a plist. Can''t convert to string.'); 0050 end 0051 0052 plstr = string(pl); 0053 0054 cmd = [cmd 'ao(' ... 0055 plstr ... 0056 ') ']; 0057 end 0058 0059 cmd = [cmd ']']; 0060 0061 if strcmp(cmd, '[]') 0062 cmd = ''; 0063 end 0064 0065 % END