Home > m > helper > ltpda_io_collect.m

ltpda_io_collect

PURPOSE ^

LTPDA_IO_COLLECT collects all AOs and plists from the inputs.

SYNOPSIS ^

function varargout = ltpda_io_collect(varargin)

DESCRIPTION ^

 LTPDA_IO_COLLECT collects all AOs and plists from the inputs.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 LTPDA_IO_COLLECT collects all AOs and plists from the inputs and returns
                  a cell array of AOs and a single combined plist.

   >> [aos, pl] = ltpda_io_collect(args)

   Inputs:
     args - cell array containing matrices or vectors of AOs or plists

   Outputs:
     aos  - a cell array of analysis objects, one for each input
     pl   - a single plist which combines all the input plists


 M Hewitson 09-10-07

 $Id: ltpda_io_collect.m,v 1.1 2007/10/08 09:35:48 hewitson Exp $

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = ltpda_io_collect(varargin)
0002 
0003 % LTPDA_IO_COLLECT collects all AOs and plists from the inputs.
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % LTPDA_IO_COLLECT collects all AOs and plists from the inputs and returns
0007 %                  a cell array of AOs and a single combined plist.
0008 %
0009 %   >> [aos, pl] = ltpda_io_collect(args)
0010 %
0011 %   Inputs:
0012 %     args - cell array containing matrices or vectors of AOs or plists
0013 %
0014 %   Outputs:
0015 %     aos  - a cell array of analysis objects, one for each input
0016 %     pl   - a single plist which combines all the input plists
0017 %
0018 %
0019 % M Hewitson 09-10-07
0020 %
0021 % $Id: ltpda_io_collect.m,v 1.1 2007/10/08 09:35:48 hewitson Exp $
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 aos = {};
0026 pl  = [];
0027 
0028 % Go through inputs
0029 for ii=1:nargin
0030   a = varargin{ii};
0031   if isa(a, 'ao')
0032     aos = [aos unpack_aos(a)];
0033   elseif isa(a, 'plist')
0034     pl = combine(pl, a);
0035   else
0036     disp(a);
0037     warning(['! unrecognised input ' num2str(ii) ': ']);
0038   end
0039 
0040 end
0041 
0042 % Set outputs
0043 if nargout == 2
0044   varargout{1} = aos;
0045   varargout{2} = pl;
0046 else
0047   help(mfilename);
0048   error('### incorrect outputs');
0049 end
0050 
0051 
0052 %--------------------------------------------------------------------------
0053 % Unpack AOs from input
0054 function aos = unpack_aos(ain)
0055 
0056 aos = {};
0057 for jj=1:numel(ain)
0058   a = ain(jj);
0059   if numel(a) > 1
0060     aos = [aos unpack_aos(a)];
0061   else
0062     aos = [aos {a}];
0063   end
0064 end
0065

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003