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