comparison m-toolbox/classes/@stattest/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 stattest objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY overloads display functionality for stattest objects.
5 %
6 % CALL: txt = display(stattest)
7 %
8 % INPUT: stattest - ltpda statistical test object
9 %
10 % OUTPUT: txt - cell array with strings to display the model object
11 %
12 % <a href="matlab:utils.helper.displayMethodInfo('stattest', 'display')">Parameters Description</a>
13 %
14 % VERSION: $Id: display.m,v 1.3 2011/04/08 08:56:38 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(:), 'stattest');
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 ii=1:numel(objs)
40 obj = objs(ii);
41 banner = sprintf('---- statistical test %d ----', ii);
42 txt{end+1} = banner;
43
44 % get key and value
45 name = obj.name;
46
47 % display name
48 txt{end+1} = [' name: ' name];
49
50 % display data
51 pstr = ' data: ';
52 N = numel(obj.data);
53 for kk=1:N
54 d = obj.data{kk};
55 if isa(d, 'ao')
56 pstr = [pstr sprintf('%s [%s/%s]', d.name, class(d), class(d.data))];
57 else
58 pstr = [pstr sprintf('%s [%s]', d.name, class(d))];
59 end
60 if kk< N
61 pstr = [pstr ', '];
62 end
63 end
64 txt{end+1} = pstr;
65
66
67 % display result
68 txt{end+1} = [' result: ' num2str(obj.result)];
69 % display pvalue
70 txt{end+1} = [' pvalue: ' num2str(obj.pvalue)];
71
72 % display description
73 txt{end+1} = sprintf('description: %s', objs(ii).description);
74
75 % display UUID
76 txt{end+1} = sprintf(' UUID: %s', objs(ii).UUID);
77
78 banner_end(1:length(banner)) = '-';
79 txt{end+1} = banner_end;
80 end
81
82 if nargout == 0
83 for ii=1:length(txt)
84 disp(txt{ii});
85 end
86 else
87 varargout{1} = txt;
88 end
89
90 end
91
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 % Local Functions %
94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %
98 % FUNCTION: getInfo
99 %
100 % DESCRIPTION: Get Info Object
101 %
102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
103
104 function ii = getInfo(varargin)
105 if nargin == 1 && strcmpi(varargin{1}, 'None')
106 sets = {};
107 pl = [];
108 else
109 sets = {'Default'};
110 pl = getDefaultPlist;
111 end
112 % Build info object
113 ii = minfo(mfilename, 'smodel', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.3 2011/04/08 08:56:38 hewitson Exp $', sets, pl);
114 ii.setModifier(false);
115 ii.setOutmin(0);
116 end
117
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119 %
120 % FUNCTION: getDefaultPlist
121 %
122 % DESCRIPTION: Get Default Plist
123 %
124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125
126 function plout = getDefaultPlist()
127 persistent pl;
128 if exist('pl', 'var')==0 || isempty(pl)
129 pl = buildplist();
130 end
131 plout = pl;
132 end
133
134 function pl = buildplist()
135 pl = plist.EMPTY_PLIST;
136 end