comparison m-toolbox/classes/@ao/setDy.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 % SETDY sets the 'dy' property of the ao.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: SETDY sets the 'dy' property of the ao.
5 %
6 % CALL: objs.setDy(val);
7 % objs.setDy(val1, val2);
8 % objs.setDy(plist('dy', val));
9 % objs = objs.setDy(val);
10 %
11 % INPUTS: objs: Can be a vector, matrix, list, or a mix of them.
12 % val:
13 % 0. An AO
14 % If objs is a single object and val is an AO
15 % then uses this function the y-values of the second
16 % AO for 'dy'.
17 % 1. Single vector e.g. [1 2 3]
18 % Each AO in objs get this value.
19 % 2. Single vector in a cell-array e.g. {[1 2 3]}
20 % Each AO in objs get this value.
21 % 3. cell-array with the same number of vectors as in objs
22 % e.g. {[6 5 4], 5, [1 2 3]} and 3 AOs in objs
23 % Each AO in objs get its corresponding value from the
24 % cell-array
25 %
26 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'setDy')">Parameters Description</a>
27 %
28 % VERSION: $Id: setDy.m,v 1.12 2011/09/16 05:03:06 hewitson Exp $
29 %
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31
32 function varargout = setDy(varargin)
33
34 % Check if this is a call from a class method
35 callerIsMethod = utils.helper.callerIsMethod;
36
37 if callerIsMethod
38 in_names = {};
39 else
40 % Collect input variable names
41 in_names = cell(size(varargin));
42 for ii = 1:nargin,in_names{ii} = inputname(ii);end
43 end
44
45 objects = setPropertyValue(...
46 varargin{:}, ...
47 in_names, ...
48 callerIsMethod, ...
49 'dy', ...
50 @setterFcn, ...
51 nargout, ...
52 @getInfo);
53
54 % set outputs
55 varargout = utils.helper.setoutputs(nargout, objects);
56
57 end
58
59 % Setter function to set dy
60 function value = setterFcn(varargin)
61
62 if nargin < 3
63 error('Please provide a value for the ''dy'' property');
64 end
65
66 obj = varargin{1};
67 pl = varargin{2};
68 value = varargin{3};
69
70 % be careful that the returned value remains an AO!
71 if isa(value, 'ao')
72 obj.data.setDy(value.y);
73 else
74 obj.data.setDy(value);
75 end
76
77 end
78
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 % Local Functions %
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 %--------------------------------------------------------------------------
83 % Get Info Object
84 %--------------------------------------------------------------------------
85 function ii = getInfo(varargin)
86
87 if nargin == 1 && strcmpi(varargin{1}, 'None')
88 sets = {};
89 pl = [];
90 else
91 sets = {'Default'};
92 pl = getDefaultPlist();
93 end
94 % Build info object
95 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: setDy.m,v 1.12 2011/09/16 05:03:06 hewitson Exp $', sets, pl);
96 end
97
98 %--------------------------------------------------------------------------
99 % Get Default Plist
100 %--------------------------------------------------------------------------
101 function plout = getDefaultPlist()
102 persistent pl;
103 if ~exist('pl', 'var') || isempty(pl)
104 pl = buildplist();
105 end
106 plout = pl;
107 end
108
109 function pl = buildplist()
110 pl = plist({'dy', 'The vector to set'}, paramValue.EMPTY_DOUBLE);
111 end
112