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