Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/setT0.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 % SETT0 sets the 't0' property of the ao. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: SETT0 sets the 't0' property of the ao. | |
5 % | |
6 % CALL: objs.setT0(val); | |
7 % objs.setT0(val1, val2); | |
8 % objs.setT0(plist('t0', val)); | |
9 % objs = objs.setT0(val); | |
10 % | |
11 % INPUTS: objs: Can be a vector, matrix, list, or a mix of them. | |
12 % val: A time-string or number | |
13 % 1. Single value e.g. '14:00:00' | |
14 % Each AO in objs get this value. | |
15 % 2. Single value in a cell-array e.g. {4} | |
16 % Each AO in objs get this value. | |
17 % 3. cell-array with the same number of values as in objs | |
18 % e.g. {'14:00:00, 5, '15:00:00'} and 3 AOs in objs | |
19 % Each AO in objs get its corresponding value from the | |
20 % cell-array | |
21 % | |
22 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'setT0')">Parameters Description</a> | |
23 % | |
24 % VERSION: $Id: setT0.m,v 1.25 2011/09/16 05:03:21 hewitson Exp $ | |
25 % | |
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
27 | |
28 | |
29 function varargout = setT0(varargin) | |
30 | |
31 % Check if this is a call from a class method | |
32 callerIsMethod = utils.helper.callerIsMethod; | |
33 | |
34 if callerIsMethod | |
35 in_names = {}; | |
36 else | |
37 % Collect input variable names | |
38 in_names = cell(size(varargin)); | |
39 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
40 end | |
41 | |
42 objects = setPropertyValue(... | |
43 varargin{:}, ... | |
44 in_names, ... | |
45 callerIsMethod, ... | |
46 't0', ... | |
47 @setterFcn, ... | |
48 nargout, ... | |
49 @getInfo); | |
50 | |
51 % set outputs | |
52 varargout = utils.helper.setoutputs(nargout, objects); | |
53 | |
54 end | |
55 | |
56 % Setter function to set the t0 | |
57 function value = setterFcn(varargin) | |
58 | |
59 if nargin < 3 | |
60 error('Please provide a value for the ''t0'' property'); | |
61 end | |
62 | |
63 obj = varargin{1}; | |
64 pl = varargin{2}; | |
65 value = varargin{3}; | |
66 | |
67 obj.data.setT0(value); | |
68 | |
69 end | |
70 | |
71 | |
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
73 % Local Functions % | |
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
75 %-------------------------------------------------------------------------- | |
76 % Get Info Object | |
77 %-------------------------------------------------------------------------- | |
78 function ii = getInfo(varargin) | |
79 | |
80 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
81 sets = {}; | |
82 pl = []; | |
83 else | |
84 sets = {'Default'}; | |
85 pl = getDefaultPlist(); | |
86 end | |
87 % Build info object | |
88 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: setT0.m,v 1.25 2011/09/16 05:03:21 hewitson Exp $', sets, pl); | |
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({'t0', ['The time to set.<br>' ... | |
104 'You can enter the t0 as a string or as a number. If you want to enter a number please enter this number and convert the type with a right click on the number to a double.']}, ... | |
105 {1, {'14:00:00 10-10-2009'}, paramValue.OPTIONAL}); | |
106 end |