comparison m-toolbox/classes/@ao/t0.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 % T0 Get the data property 't0'.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: Get the data property 't0'.
5 %
6 % CALL: val = t0(a1,a2,a3,...)
7 % val = t0(as)
8 % val = as.t0()
9 %
10 % INPUTS: aN - input analysis objects (tsdata or fsdata)
11 % as - input analysis objects array (tsdata or fsdata)
12 %
13 % OUTPUTS: val - array of with 't0', one for each input
14 %
15 % <a href="matlab:utils.helper.displayMethodInfo('ao', 't0')">Parameters Description</a>
16 %
17 % VERSION: $Id: t0.m,v 1.14 2011/04/08 08:56:15 hewitson Exp $
18 %
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21 function varargout = t0(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 property = 't0';
31
32 % Check if the method was called by another method
33 callerIsMethod = utils.helper.callerIsMethod;
34
35 if ~callerIsMethod
36 % Collect all AOs
37 as = utils.helper.collect_objects(varargin(:), 'ao');
38 else
39 % Assume the input is a single AO or a vector of AOs
40 as = varargin{1};
41 end
42
43 % Extract the property
44 for jj = 1:numel(as)
45 if isprop(as(jj).data, property)
46 out(jj) = as(jj).data.(property);
47 else
48 utils.helper.msg(msg.IMPORTANT, 'The %dth object has no %s property. Setting result to NaN', jj, property);
49 out(jj) = time(NaN);
50 end
51 end
52
53 % Set output
54 if nargout == numel(as)
55 % List of outputs
56 for ii = 1:numel(as)
57 varargout{ii} = out(ii);
58 end
59 else
60 % Single output
61 varargout{1} = out;
62 end
63
64 end
65
66 %--------------------------------------------------------------------------
67 % Get Info Object
68 %--------------------------------------------------------------------------
69 function ii = getInfo(varargin)
70 if nargin == 1 && strcmpi(varargin{1}, 'None')
71 sets = {};
72 pl = [];
73 else
74 sets = {'Default'};
75 pl = getDefaultPlist;
76 end
77 % Build info object
78 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: t0.m,v 1.14 2011/04/08 08:56:15 hewitson Exp $', sets, pl);
79 ii.setModifier(false);
80 end
81
82 %--------------------------------------------------------------------------
83 % Get Default Plist
84 %--------------------------------------------------------------------------
85 function plout = getDefaultPlist()
86 persistent pl;
87 if ~exist('pl', 'var') || isempty(pl)
88 pl = buildplist();
89 end
90 plout = pl;
91 end
92
93 function pl = buildplist()
94 pl = plist.EMPTY_PLIST;
95 end