comparison m-toolbox/classes/@ao/demux.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 % DEMUX splits the input vector of AOs into a number of output AOs.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DEMUX splits the input vector of AOs into a number of output AOs.
5 %
6 % REMARK: This is a transparent function and as such does not add history.
7 %
8 % CALL: [a1,a2,...] = demux(as)
9 %
10 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'demux')">Parameters Description</a>
11 %
12 % VERSION: $Id: demux.m,v 1.21 2011/04/08 08:56:15 hewitson Exp $
13 %
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16 function varargout = demux(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
32 as = utils.helper.collect_objects(varargin(:), 'ao', in_names);
33
34 % get number of input AOs
35 n = numel(as);
36 if nargout > n
37 error('### too many output arguments');
38 elseif nargout < n
39 error('### not enough output arguments');
40 end
41
42 for j=1:nargout
43 % map to output AO
44 varargout{j} = as(j);
45 end
46 end
47
48 %--------------------------------------------------------------------------
49 % Get Info Object
50 %--------------------------------------------------------------------------
51 function ii = getInfo(varargin)
52
53 if nargin == 1 && strcmpi(varargin{1}, 'None')
54 sets = {};
55 pl = [];
56 else
57 sets = {'Default'};
58 pl = getDefaultPlist;
59 end
60 % Build info object
61 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: demux.m,v 1.21 2011/04/08 08:56:15 hewitson Exp $', sets, pl);
62 ii.setModifier(false);
63 end
64
65 %--------------------------------------------------------------------------
66 % Get Default Plist
67 %--------------------------------------------------------------------------
68
69
70 function plout = getDefaultPlist()
71 persistent pl;
72 if exist('pl', 'var')==0 || isempty(pl)
73 pl = buildplist();
74 end
75 plout = pl;
76 end
77
78 function pl = buildplist()
79 pl = plist.EMPTY_PLIST;
80 end
81