Mercurial > hg > ltpda
comparison m-toolbox/classes/@plist/nparams.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 % NPARAMS returns the number of param objects in the list. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: NPARAMS returns the number of param objects in the list. | |
5 % | |
6 % CALL: n = nparams(plist) | |
7 % | |
8 % <a href="matlab:utils.helper.displayMethodInfo('plist', 'nparams')">Parameters Description</a> | |
9 % | |
10 % VERSION: $Id: nparams.m,v 1.17 2011/04/08 08:56:21 hewitson Exp $ | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function varargout = nparams(varargin) | |
15 | |
16 %%% Check if this is a call for parameters | |
17 if utils.helper.isinfocall(varargin{:}) | |
18 varargout{1} = getInfo(varargin{3}); | |
19 return | |
20 end | |
21 | |
22 objs = utils.helper.collect_objects(varargin(:), 'plist'); | |
23 | |
24 n = []; | |
25 for ii = 1:numel(objs) | |
26 n = [n length(objs(ii).params)]; | |
27 end | |
28 | |
29 varargout{1} = n; | |
30 end | |
31 | |
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
33 % Local Functions % | |
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
35 | |
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
37 % | |
38 % FUNCTION: getInfo | |
39 % | |
40 % DESCRIPTION: Get Info Object | |
41 % | |
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
43 | |
44 function ii = getInfo(varargin) | |
45 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
46 sets = {}; | |
47 pl = []; | |
48 else | |
49 sets = {'Default'}; | |
50 pl = getDefaultPlist; | |
51 end | |
52 % Build info object | |
53 ii = minfo(mfilename, 'plist', 'ltpda', utils.const.categories.helper, '$Id: nparams.m,v 1.17 2011/04/08 08:56:21 hewitson Exp $', sets, pl); | |
54 ii.setModifier(false); | |
55 ii.setArgsmin(1); | |
56 end | |
57 | |
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
59 % | |
60 % FUNCTION: getDefaultPlist | |
61 % | |
62 % DESCRIPTION: Get Default Plist | |
63 % | |
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
65 | |
66 function plo = getDefaultPlist() | |
67 plo = plist(); | |
68 end | |
69 |