comparison m-toolbox/classes/@collection/nobjs.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 % NOBJS Returns the number of objects in the inner object array.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: Returns the number of columns of the inner object array.
5 %
6 % CALL: m = nobjs(collection-object);
7 % m = collection.ncols();
8 %
9 % <a href="matlab:utils.helper.displayMethodInfo('collection', 'nobjs')">Parameters Description</a>
10 %
11 % VERSION: $Id: nobjs.m,v 1.5 2011/04/08 08:56:21 hewitson Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function varargout = nobjs(varargin)
16
17 % Check if this is a call for parameters
18 if utils.helper.isinfocall(varargin{:})
19 varargout{1} = getInfo(varargin{3});
20 return
21 end
22
23 % Collect all AOs
24 ms = utils.helper.collect_objects(varargin(:), 'collection');
25
26 if numel(ms) ~= 1
27 error('### This method can only handle one collection object but there are [%d] objects.', numel(ms));
28 end
29
30 varargout{1} = numel(ms.objs);
31
32 end
33
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 % Local Functions %
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %
40 % FUNCTION: getInfo
41 %
42 % DESCRIPTION: Get Info Object
43 %
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45
46 function ii = getInfo(varargin)
47 if nargin == 1 && strcmpi(varargin{1}, 'None')
48 sets = {};
49 pl = [];
50 else
51 sets = {'Default'};
52 pl = getDefaultPlist;
53 end
54 % Build info object
55 ii = minfo(mfilename, 'collection', 'ltpda', utils.const.categories.helper, '$Id: nobjs.m,v 1.5 2011/04/08 08:56:21 hewitson Exp $', sets, pl);
56 end
57
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 %
60 % FUNCTION: getDefaultPlist
61 %
62 % DESCRIPTION: Get Default Plist
63 %
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65
66 function plout = getDefaultPlist()
67 persistent pl;
68 if exist('pl', 'var')==0 || isempty(pl)
69 pl = buildplist();
70 end
71 plout = pl;
72 end
73
74 function pl = buildplist()
75 pl = plist.EMPTY_PLIST;
76 end
77