COLLECT_INPUTS Collect the AOs and Plists. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: COLLECT_INPUTS Collect the AOs and Plists. CALL: [aos, pls, invars] = collect_inputs(varargin, in_names); INPUTS: varargin: A list of analysis objects (ao's) and parameter lists (plist's) in_names: Corresponding variable names of the contents in varargin OUTPUTS: aos: Collection of all analysis objects pls: Collection of parameter lists invars: Collection of the ao names of the corresponding ao. VERSION: $Id: collect_inputs.html,v 1.1 2008/03/01 12:29:34 hewitson Exp $ HISTORY: 08-05-07 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [aos, pls, invars] = collect_inputs(varargin, in_names) 0002 % COLLECT_INPUTS Collect the AOs and Plists. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: COLLECT_INPUTS Collect the AOs and Plists. 0007 % 0008 % CALL: [aos, pls, invars] = collect_inputs(varargin, in_names); 0009 % 0010 % INPUTS: varargin: A list of analysis objects (ao's) and 0011 % parameter lists (plist's) 0012 % in_names: Corresponding variable names of the contents in 0013 % varargin 0014 % 0015 % OUTPUTS: aos: Collection of all analysis objects 0016 % pls: Collection of parameter lists 0017 % invars: Collection of the ao names of the corresponding ao. 0018 % 0019 % VERSION: $Id: collect_inputs.html,v 1.1 2008/03/01 12:29:34 hewitson Exp $ 0020 % 0021 % HISTORY: 08-05-07 Diepholz 0022 % Creation 0023 % 0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0025 0026 0027 % dd1 = dbstack 0028 % dd2 = dbstatus 0029 0030 aos = []; 0031 invars = {}; 0032 pls = plist(); 0033 0034 %% collect input ao's, plist's and ao variable names 0035 0036 for j=1:numel(varargin) 0037 0038 if isa(varargin{j}, 'ao') 0039 aos = [aos varargin{j}]; 0040 0041 ao_name = in_names{j}; 0042 if isempty(ao_name) 0043 ao_name = 'no_ao_name'; 0044 end 0045 0046 % Memorise the variable name of the corresponding analysis object. 0047 % If the ao is an array or vector add the index to the variable name 0048 if numel(varargin{j}) == 1 0049 invars{end+1} = ao_name; 0050 else 0051 for ii=1:numel(varargin{j}) 0052 [I,J] = ind2sub(size(varargin{j}),ii); 0053 invars{end+1} = sprintf('%s(%d,%d)', ao_name, I, J); 0054 end 0055 end 0056 end 0057 if isa(varargin{j}, 'plist') 0058 pls = [pls varargin{j}]; 0059 end 0060 end