Mercurial > hg > ltpda
diff m-toolbox/classes/@ao/cat.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ao/cat.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,80 @@ +% CAT concatenate AOs into a row vector. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: CAT concatenate AOs into a row vector. +% +% CALL: a = cat(a1, a2) +% +% REMARK: This method is a transparent method, and doesn't add history. +% +% <a href="matlab:utils.helper.displayMethodInfo('ao', 'cat')">Parameters Description</a> +% +% VERSION: $Id: cat.m,v 1.24 2011/04/08 08:56:13 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function varargout = cat(varargin) + + % Check if this is a call for parameters + if utils.helper.isinfocall(varargin{:}) + varargout{1} = getInfo(varargin{3}); + return + end + + import utils.const.* + utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); + + % Collect input variable names + in_names = cell(size(varargin)); + for ii = 1:nargin,in_names{ii} = inputname(ii);end + + % Collect all AOs and plists + as = utils.helper.collect_objects(varargin(:), 'ao', in_names); + + % Decide on a deep copy or a modify + bs = copy(as, nargout); + + % Reshape always to a row vector + bs = reshape(bs, 1, []); + + % Set output + if nargout == 0 + error('### cat cannot be used as a modifier. Please give an output variable.'); + else + varargout{1} = bs; + end +end + +%-------------------------------------------------------------------------- +% Get Info Object +%-------------------------------------------------------------------------- +function ii = getInfo(varargin) + if nargin == 1 && strcmpi(varargin{1}, 'None') + sets = {}; + pl = []; + else + sets = {'Default'}; + pl = getDefaultPlist; + end + % Build info object + ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.op, '$Id: cat.m,v 1.24 2011/04/08 08:56:13 hewitson Exp $', sets, pl); + ii.setModifier(false); +end + +%-------------------------------------------------------------------------- +% Get Default Plist +%-------------------------------------------------------------------------- + +function plout = getDefaultPlist() + persistent pl; + if exist('pl', 'var')==0 || isempty(pl) + pl = buildplist(); + end + plout = pl; +end + +function pl_default = buildplist() + pl_default = plist.EMPTY_PLIST; +end + +