Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % CAT concatenate AOs into a row vector. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: CAT concatenate AOs into a row vector. | |
5 % | |
6 % CALL: a = cat(a1, a2) | |
7 % | |
8 % REMARK: This method is a transparent method, and doesn't add history. | |
9 % | |
10 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'cat')">Parameters Description</a> | |
11 % | |
12 % VERSION: $Id: cat.m,v 1.24 2011/04/08 08:56:13 hewitson Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function varargout = cat(varargin) | |
17 | |
18 % Check if this is a call for parameters | |
19 if utils.helper.isinfocall(varargin{:}) | |
20 varargout{1} = getInfo(varargin{3}); | |
21 return | |
22 end | |
23 | |
24 import utils.const.* | |
25 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
26 | |
27 % Collect input variable names | |
28 in_names = cell(size(varargin)); | |
29 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
30 | |
31 % Collect all AOs and plists | |
32 as = utils.helper.collect_objects(varargin(:), 'ao', in_names); | |
33 | |
34 % Decide on a deep copy or a modify | |
35 bs = copy(as, nargout); | |
36 | |
37 % Reshape always to a row vector | |
38 bs = reshape(bs, 1, []); | |
39 | |
40 % Set output | |
41 if nargout == 0 | |
42 error('### cat cannot be used as a modifier. Please give an output variable.'); | |
43 else | |
44 varargout{1} = bs; | |
45 end | |
46 end | |
47 | |
48 %-------------------------------------------------------------------------- | |
49 % Get Info Object | |
50 %-------------------------------------------------------------------------- | |
51 function ii = getInfo(varargin) | |
52 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
53 sets = {}; | |
54 pl = []; | |
55 else | |
56 sets = {'Default'}; | |
57 pl = getDefaultPlist; | |
58 end | |
59 % Build info object | |
60 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); | |
61 ii.setModifier(false); | |
62 end | |
63 | |
64 %-------------------------------------------------------------------------- | |
65 % Get Default Plist | |
66 %-------------------------------------------------------------------------- | |
67 | |
68 function plout = getDefaultPlist() | |
69 persistent pl; | |
70 if exist('pl', 'var')==0 || isempty(pl) | |
71 pl = buildplist(); | |
72 end | |
73 plout = pl; | |
74 end | |
75 | |
76 function pl_default = buildplist() | |
77 pl_default = plist.EMPTY_PLIST; | |
78 end | |
79 | |
80 |