comparison m-toolbox/classes/@pest/display.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 % DISPLAY overloads display functionality for pest objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY overloads display functionality for pest objects.
5 %
6 % CALL: txt = display(pest)
7 %
8 % INPUT: pest - pest object
9 %
10 % OUTPUT: txt - cell array with strings to display the pest object
11 %
12 % <a href="matlab:utils.helper.displayMethodInfo('pest', 'display')">Parameters Description</a>
13 %
14 % VERSION: $Id: display.m,v 1.11 2011/04/08 08:56:25 hewitson Exp $
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function varargout = display(varargin)
19
20 %%% Check if this is a call for parameters
21 if utils.helper.isinfocall(varargin{:})
22 varargout{1} = getInfo(varargin{3});
23 return
24 end
25
26 objs = utils.helper.collect_objects(varargin(:), 'pest');
27
28 txt = {};
29
30 % Print emtpy object
31 if isempty(objs)
32 hdr = sprintf('------ %s -------', class(objs));
33 ftr(1:length(hdr)) = '-';
34 txt = [txt; {hdr}];
35 txt = [txt; sprintf('empty-object [%d,%d]',size(objs))];
36 txt = [txt; {ftr}];
37 end
38
39 for jj=1:numel(objs)
40 banner = sprintf('---- pest %d ----', jj);
41 txt = [txt; {banner}];
42
43 % display
44 txt = [txt; {sprintf(' name: %s', objs(jj).name)}];
45 txt = [txt; {sprintf('param names: %s', utils.helper.val2str(objs(jj).names))}];
46 txt = [txt; {sprintf(' y: %s', utils.helper.val2str(objs(jj).y))}];
47 txt = [txt; {sprintf(' dy: %s', utils.helper.val2str(objs(jj).dy))}];
48 txt = [txt; {sprintf(' yunits: %s', char(objs(jj).yunits))}];
49 txt = [txt; {sprintf(' pdf: %s', utils.helper.val2str(objs(jj).pdf))}];
50 txt = [txt; {sprintf(' cov: %s', utils.helper.val2str(objs(jj).cov))}];
51 txt = [txt; {sprintf(' corr: %s', utils.helper.val2str(objs(jj).corr))}];
52 txt = [txt; {sprintf(' chain: %s', utils.helper.val2str(objs(jj).chain))}];
53 txt = [txt; {sprintf(' chi2: %s', utils.helper.val2str(objs(jj).chi2))}];
54 txt = [txt; {sprintf(' dof: %s', num2str(objs(jj).dof))}];
55 txt = [txt; {sprintf(' models: %s', char(objs(jj).models))}];
56 txt = [txt; {sprintf('description: %s', objs(jj).description)}];
57 txt = [txt; {sprintf(' UUID: %s', objs(jj).UUID)}];
58 banner_end(1:length(banner)) = '-';
59 txt = [txt; {banner_end}];
60 end
61
62 if nargout == 0
63 for jj=1:length(txt)
64 disp(txt{jj});
65 end
66 else
67 varargout{1} = txt;
68 end
69
70 end
71
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 % Local Functions %
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %
78 % FUNCTION: getInfo
79 %
80 % DESCRIPTION: Get Info Object
81 %
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83
84 function ii = getInfo(varargin)
85 if nargin == 1 && strcmpi(varargin{1}, 'None')
86 sets = {};
87 pl = [];
88 else
89 sets = {'Default'};
90 pl = getDefaultPlist;
91 end
92 % Build info object
93 ii = minfo(mfilename, 'pest', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.11 2011/04/08 08:56:25 hewitson Exp $', sets, pl);
94 ii.setModifier(false);
95 ii.setOutmin(0);
96 end
97
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 %
100 % FUNCTION: getDefaultPlist
101 %
102 % DESCRIPTION: Get Default Plist
103 %
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105
106 function plout = getDefaultPlist()
107 persistent pl;
108 if exist('pl', 'var')==0 || isempty(pl)
109 pl = buildplist();
110 end
111 plout = pl;
112 end
113
114 function plo = buildplist()
115 plo = plist.EMPTY_PLIST;
116 end
117
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119 %
120 % FUNCTION: mat2valstr
121 %
122 % DESCRIPTION: Convert a matrix into a string with the maximum size of 40 characters
123 %
124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125
126 function str = mat2valstr(val)
127 str = mat2str(val,5);
128 if numel(str) > 40
129 str = [str(1:40), ' ...'];
130 end
131 end
132
133