comparison m-toolbox/classes/@timespan/char.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 % CHAR convert a timespan object into a string.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CHAR convert a timespan object into a string.
5 %
6 % CALL: c = char(timespan)
7 %
8 % FORMAT: c = '(start: xxx end: xxx)'
9 %
10 % <a href="matlab:utils.helper.displayMethodInfo('timespan', 'char')">Parameters Description</a>
11 %
12 % VERSION: $Id: char.m,v 1.11 2011/04/08 08:56:37 hewitson Exp $
13 %
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16 function varargout = char(varargin)
17
18 %%% Check if this is a call for parameters
19 if utils.helper.isinfocall(varargin{:})
20 varargout{1} = getInfo(varargin{3});
21 return
22 end
23
24 % Collect all time-objects
25 objs = utils.helper.collect_objects(varargin(:), 'timespan');
26
27 % go through time-object
28 pstr = '';
29 for jj=1:numel(objs)
30 pstr = [pstr '(start: ' char(objs(jj).startT) ' end: ' char(objs(jj).endT) '), '];
31 end
32
33 varargout{1} = pstr(1:end-2);
34 end
35
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 % Local Functions %
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 % FUNCTION: getInfo
43 %
44 % DESCRIPTION: Get Info Object
45 %
46 % HISTORY: 11-07-07 M Hewitson
47 % Creation.
48 %
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50
51 function ii = getInfo(varargin)
52 if nargin == 1 && strcmpi(varargin{1}, 'None')
53 sets = {};
54 pl = [];
55 else
56 sets = {'Default'};
57 pl = getDefaultPlist;
58 end
59 % Build info object
60 ii = minfo(mfilename, 'timespan', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.11 2011/04/08 08:56:37 hewitson Exp $', sets, pl);
61 ii.setModifier(false);
62 end
63
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %
66 % FUNCTION: getDefaultPlist
67 %
68 % DESCRIPTION: Get Default Plist
69 %
70 % HISTORY: 11-07-07 M Hewitson
71 % Creation.
72 %
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74
75 function plout = getDefaultPlist()
76 persistent pl;
77 if exist('pl', 'var')==0 || isempty(pl)
78 pl = buildplist();
79 end
80 plout = pl;
81 end
82
83 function pl = buildplist()
84 pl = plist.EMPTY_PLIST;
85 end
86