comparison m-toolbox/classes/@smodel/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 smodel object into a string.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CHAR convert a smodel object into a string.
5 %
6 % CALL: string = char(smodel)
7 %
8 % <a href="matlab:utils.helper.displayMethodInfo('smodel', 'char')">Parameters Description</a>
9 %
10 % VERSION: $Id: char.m,v 1.7 2011/04/08 08:56:30 hewitson Exp $
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function varargout = char(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(:), 'smodel');
23
24 pstr = '';
25
26 for ii = 1:numel(objs)
27 pstr = [pstr 'smodel(' char(objs(ii).expr) '), '];
28 end
29
30 varargout{1} = pstr(1:end-2);
31 end
32
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 % Local Functions %
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 %
39 % FUNCTION: getInfo
40 %
41 % DESCRIPTION: Get Info Object
42 %
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44
45 function ii = getInfo(varargin)
46 if nargin == 1 && strcmpi(varargin{1}, 'None')
47 sets = {};
48 pl = [];
49 else
50 sets = {'Default'};
51 pl = getDefaultPlist;
52 end
53 % Build info object
54 ii = minfo(mfilename, 'smodel', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.7 2011/04/08 08:56:30 hewitson Exp $', sets, pl);
55 ii.setModifier(false);
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