comparison m-toolbox/classes/@pest/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 pest object into a string.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CHAR convert a pest object into a string.
5 %
6 % CALL: string = char(pest)
7 %
8 % <a href="matlab:utils.helper.displayMethodInfo('pest', 'char')">Parameters Description</a>
9 %
10 % VERSION: $Id: char.m,v 1.7 2011/04/18 16:49:45 ingo 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(:), 'pest');
23
24 pstr = '';
25
26 for ii = 1:numel(objs)
27 if isempty(objs(ii).name)
28 name = 'pestObj';
29 else
30 name = objs(ii).name;
31 end
32 pstr = sprintf('%s%s(%s, %s), ', pstr, name, utils.helper.val2str(objs(ii).names), utils.helper.val2str(objs(ii).y));
33 end
34
35 varargout{1} = pstr(1:end-2);
36 end
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 % Local Functions %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 %
44 % FUNCTION: getInfo
45 %
46 % DESCRIPTION: Get Info Object
47 %
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49
50 function ii = getInfo(varargin)
51 if nargin == 1 && strcmpi(varargin{1}, 'None')
52 sets = {};
53 pl = [];
54 else
55 sets = {'Default'};
56 pl = getDefaultPlist;
57 end
58 % Build info object
59 ii = minfo(mfilename, 'pest', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.7 2011/04/18 16:49:45 ingo Exp $', sets, pl);
60 ii.setModifier(false);
61 end
62
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 %
65 % FUNCTION: getDefaultPlist
66 %
67 % DESCRIPTION: Get Default Plist
68 %
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70
71 function plout = getDefaultPlist()
72 persistent pl;
73 if exist('pl', 'var')==0 || isempty(pl)
74 pl = buildplist();
75 end
76 plout = pl;
77 end
78
79 function plo = buildplist()
80 plo = plist.EMPTY_PLIST;
81 end
82