Mercurial > hg > ltpda
comparison m-toolbox/classes/@pest/setYunits.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 % SETYUNITS Set the property 'yunits' | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: SETYUNITS Set the property 'yunits' | |
5 % | |
6 % CALL: obj = obj.setYunits([unit('Hz') unit('V')]); | |
7 % obj = obj.setYunits(plist('yunits', [unit('Hz') unit('V')])); | |
8 % obj.setYunits([unit('Hz') unit('V')]); | |
9 % | |
10 % INPUTS: obj - can be a vector, matrix, list, or a mix of them. | |
11 % pl - to set the 'yunits' with a plist specify only one plist with | |
12 % only one key-word 'yunits'. | |
13 % | |
14 % <a href="matlab:utils.helper.displayMethodInfo('pest', 'setYunits')">Parameters Description</a> | |
15 % | |
16 % VERSION: $Id: setYunits.m,v 1.7 2011/04/08 08:56:25 hewitson Exp $ | |
17 % | |
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
19 | |
20 function varargout = setYunits(varargin) | |
21 | |
22 %%% Check if this is a call for parameters | |
23 if utils.helper.isinfocall(varargin{:}) | |
24 varargout{1} = getInfo(varargin{3}); | |
25 return | |
26 end | |
27 | |
28 prop = 'yunits'; | |
29 | |
30 % Collect input variable names | |
31 in_names = cell(size(varargin)); | |
32 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
33 | |
34 import utils.const.* | |
35 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
36 | |
37 % Check if this is a call from a class method | |
38 callerIsMethod = utils.helper.callerIsMethod; | |
39 | |
40 if nargout >= 1 | |
41 out = genericSet(varargin{:}, prop, in_names, callerIsMethod); | |
42 else | |
43 genericSet(varargin{:}, prop, in_names, callerIsMethod); | |
44 out = varargin{1}; | |
45 end | |
46 | |
47 % Set output | |
48 if nargout == numel(out) | |
49 % List of outputs | |
50 for ii = 1:numel(out) | |
51 varargout{ii} = out(ii); | |
52 end | |
53 else | |
54 % Single output | |
55 varargout{1} = out; | |
56 end | |
57 | |
58 end | |
59 | |
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
61 % Local Functions % | |
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
63 | |
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
65 % | |
66 % FUNCTION: getInfo | |
67 % | |
68 % DESCRIPTION: Get Info Object | |
69 % | |
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
71 | |
72 function ii = getInfo(varargin) | |
73 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
74 sets = {}; | |
75 pl = []; | |
76 else | |
77 sets = {'Default'}; | |
78 pl = getDefaultPlist; | |
79 end | |
80 % Build info object | |
81 ii = minfo(mfilename, 'pest', 'ltpda', utils.const.categories.helper, '$Id: setYunits.m,v 1.7 2011/04/08 08:56:25 hewitson Exp $', sets, pl); | |
82 end | |
83 | |
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
85 % | |
86 % FUNCTION: getDefaultPlist | |
87 % | |
88 % DESCRIPTION: Get Default Plist | |
89 % | |
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
91 | |
92 function plout = getDefaultPlist() | |
93 persistent pl; | |
94 if exist('pl', 'var')==0 || isempty(pl) | |
95 pl = buildplist(); | |
96 end | |
97 plout = pl; | |
98 end | |
99 | |
100 function plo = buildplist() | |
101 plo = plist({'yunits', 'Units of each parameter for the parameter estimate (pest) object.'}, []); | |
102 end | |
103 |