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) M-FILE INFO: Get information about this methods by calling >> ao.getInfo('string') Get information about a specified set-plist by calling: >> ao.getInfo('string', 'None') VERSION: $Id: string.m,v 1.10 2008/09/05 11:05:29 ingo Exp $ HISTORY: 29-03-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % STRING writes a command string that can be used to recreate the input Analysis object(s). 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: STRING writes a command string that can be used to recreate the 0005 % input Analysis object(s). 0006 % 0007 % CALL: cmd = string(a1) 0008 % 0009 % M-FILE INFO: Get information about this methods by calling 0010 % >> ao.getInfo('string') 0011 % 0012 % Get information about a specified set-plist by calling: 0013 % >> ao.getInfo('string', 'None') 0014 % 0015 % VERSION: $Id: string.m,v 1.10 2008/09/05 11:05:29 ingo Exp $ 0016 % 0017 % HISTORY: 29-03-07 M Hewitson 0018 % Creation 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 0022 function varargout = string(varargin) 0023 0024 % Check if this is a call for parameters 0025 if utils.helper.isinfocall(varargin{:}) 0026 varargout{1} = getInfo(varargin{3}); 0027 return 0028 end 0029 0030 import utils.const.* 0031 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0032 0033 % Collect input variable names 0034 in_names = cell(size(varargin)); 0035 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0036 0037 % Collect all AOs and plists 0038 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0039 0040 % Loop over AOs 0041 cmd = '['; 0042 for j=1:length(as) 0043 if isempty(as(j).hist.plistUsed) 0044 error('### this AO was not created with a plist. Can''t convert to string.'); 0045 end 0046 plstr = string(as(j).hist.plistUsed); 0047 cmd = [cmd 'ao(' ... 0048 plstr ... 0049 ') ']; 0050 end 0051 cmd = [cmd ']']; 0052 if strcmp(cmd, '[]') 0053 cmd = ''; 0054 end 0055 0056 % Set output 0057 varargout{1} = cmd; 0058 end 0059 0060 %-------------------------------------------------------------------------- 0061 % Get Info Object 0062 %-------------------------------------------------------------------------- 0063 function ii = getInfo(varargin) 0064 if nargin == 1 && strcmpi(varargin{1}, 'None') 0065 sets = {}; 0066 pl = []; 0067 else 0068 sets = {'Default'}; 0069 pl = getDefaultPlist; 0070 end 0071 % Build info object 0072 ii = minfo(mfilename, 'ao', '', utils.const.categories.helper, '$Id: string.m,v 1.10 2008/09/05 11:05:29 ingo Exp $', sets, pl); 0073 end 0074 0075 %-------------------------------------------------------------------------- 0076 % Get Default Plist 0077 %-------------------------------------------------------------------------- 0078 function pl_default = getDefaultPlist() 0079 pl_default = plist(); 0080 end 0081 % END 0082