Home > m > helper > collect_inputs.m

collect_inputs

PURPOSE ^

COLLECT_INPUTS Collect the AOs and Plists.

SYNOPSIS ^

function [aos, pls, invars] = collect_inputs(varargin, in_names)

DESCRIPTION ^

 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.4 2008/03/31 10:27:31 hewitson Exp $

 HISTORY:     08-05-07 Diepholz
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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.4 2008/03/31 10:27:31 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    = [];
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     a   = varargin{j};
0040     aos = [aos a];
0041 
0042     ao_name = in_names{j};
0043     if isempty(ao_name)
0044       ao_name = 'no_ao_name';
0045     end
0046 
0047     % Memorise the variable name of the corresponding analysis object.
0048     % If the ao is an array or vector add the index to the variable name
0049     %
0050     % we choose the AO name if it is not set to the default
0051     % and it's not empty.
0052     if numel(a) == 1
0053       if ~isempty(a.name) && ~strcmp(a.name, 'None')
0054         ao_name = a.name;
0055       end
0056       invars{end+1} = ao_name;
0057     else
0058       for ii=1:numel(a)
0059         if ~isempty(a(ii).name) && ~strcmp(a(ii).name, 'None')
0060           ao_name = a(ii).name;
0061         end
0062         [I,J] = ind2sub(size(a),ii);
0063         invars{end+1} = sprintf('%s(%d,%d)', ao_name, I, J);
0064       end
0065     end
0066   elseif isa(varargin{j}, 'plist')
0067     pls = [pls varargin{j}];
0068   elseif isnumeric(varargin{j})
0069     invars{end+1} = num2str(varargin{j});
0070   end
0071 end
0072 
0073 if isempty(pls)
0074   pls = plist;
0075 end

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003