comparison m-toolbox/classes/@ao/x.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 % X Get the data property 'x'.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: Get the data property 'x'.
5 %
6 % CALL: val = x(a1,a2,a3,...)
7 % val = x(as)
8 % val = as.x()
9 %
10 % INPUTS: aN - input analysis objects
11 % as - input analysis objects array
12 %
13 % OUTPUTS: val - matrix with 'x', one column for each input object
14 %
15 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'x')">Parameters Description</a>
16 %
17 % VERSION: $Id: x.m,v 1.16 2011/04/19 17:05:45 ingo Exp $
18 %
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21 function varargout = x(varargin)
22
23 % Check if this is a call for parameters
24 if utils.helper.isinfocall(varargin{:})
25 varargout{1} = getInfo(varargin{3});
26 return
27 end
28
29 import utils.const.*
30
31 % Check if the method was called by another method
32 callerIsMethod = utils.helper.callerIsMethod;
33
34 if ~callerIsMethod
35 % Collect all AOs
36 [as, dummy, rest] = utils.helper.collect_objects(varargin(:), 'ao');
37
38 % Collect numeric and char arguments to pass to getX
39 args = {};
40 for kk = 1:numel(rest)
41 if isnumeric(rest{kk}) || ischar(rest{kk}) || islogical(rest{kk})
42 args = [args {rest{kk}}];
43 end
44 end
45 else
46 % Assume the input is a single AO or a vector of AOs
47 as = varargin{1};
48
49 % Collect numeric and char arguments to pass to getX
50 args = {};
51 for kk = 2:nargin
52 if isnumeric(varargin{kk}) || ischar(varargin{kk}) || islogical(varargin{kk})
53 args = [args {varargin{kk}}];
54 end
55 end
56 end
57
58 % Get property
59 out = [];
60 for jj = 1:numel(as)
61 if isprop(as(jj).data, 'x')
62 out = [out as(jj).data.getX(args{:})];
63 else
64 out = [];
65 utils.helper.msg(msg.IMPORTANT, 'At least one of the input objects has no x property. Setting all results to [].');
66 break
67 end
68 end
69
70 % Set output
71 varargout{1} = out;
72
73 end
74
75 %--------------------------------------------------------------------------
76 % Get Info Object
77 %--------------------------------------------------------------------------
78 function ii = getInfo(varargin)
79 if nargin == 1 && strcmpi(varargin{1}, 'None')
80 sets = {};
81 pl = [];
82 else
83 sets = {'Default'};
84 pl = getDefaultPlist;
85 end
86 % Build info object
87 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: x.m,v 1.16 2011/04/19 17:05:45 ingo Exp $', sets, pl);
88 ii.setModifier(false);
89 end
90
91 %--------------------------------------------------------------------------
92 % Get Default Plist
93 %--------------------------------------------------------------------------
94 function plout = getDefaultPlist()
95 persistent pl;
96 if ~exist('pl', 'var') || isempty(pl)
97 pl = buildplist();
98 end
99 plout = pl;
100 end
101
102 function pl = buildplist()
103 pl = plist.EMPTY_PLIST;
104 end