0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % REPORT generates an HTML report about the input objects.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: REPORT generates an HTML report about the input objects.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CALL: report(objs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % report(objs, options);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % INPUTS: objs - LTPDA objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % options - a plist of options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % PARAMETERS:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % 'dir' - report dir [default: <temp dir>/ltpda_report/<date><time>]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % 'extras' - true [default] or false: plot data and diagrams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % for objects, output mfile, and type() output.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % 'desc' - give a description to appear on the main report
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % page.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % 'save' - include saved versions of the objects in the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % report directory. Objects are saved as XML.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % Specify with true or false [default]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % 'zip' - compress the report directory to a ZIP file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % 'plots' - specify a cell-array of objects to build
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % plots on the main page. Each cell gets its
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 % own plot. Example: {[a1, a3], {a5}}.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % 'overwrite' - overwrite the report directory if it exists.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % Specify true or false [default].
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % <a href="matlab:utils.helper.displayMethodInfo('ltpda_uoh', 'report')">Parameters Description</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % VERSION: $Id: report.m,v 1.20 2011/04/08 08:56:30 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 function varargout = report(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % starting initial checks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 % Check if this is a call for parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 if utils.helper.isinfocall(varargin{:})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 varargout{1} = getInfo(varargin{3});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % Collect input variable names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 in_names = cell(size(varargin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 for ii = 1:nargin,in_names{ii} = inputname(ii);end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % Collect all objs and plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 objs = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 objnames = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 classes = utils.helper.ltpda_userclasses;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 for jj=1:numel(classes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % can I create this type of class?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 feval(classes{jj});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 [oos, obj_invars] = utils.helper.collect_objects(varargin(:), classes{jj}, in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 if ~isempty(oos) && ~isa(oos, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 objs = [objs {oos}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 objnames = [objnames obj_invars];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 % get plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 pl = utils.helper.collect_objects(varargin(:), 'plist');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 pl = combine(pl, getDefaultPlist('Default'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 % Get options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 outdir = find(pl, 'dir');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 plotOn = find(pl, 'extras');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 saveXML = find(pl, 'save');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 compress = find(pl, 'zip');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 groupPlot = find(pl, 'plots');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % Create output dir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 if isempty(outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 outdir = fullfile(tempdir, 'ltpda_report', datestr(now, 30));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 elseif (outdir == '.')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 outdir = fullfile('ltpda_report', datestr(now, 30));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % Does the directory exist?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 if find(pl, 'overwrite')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 if exist(outdir, 'dir') ~= 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 [success, msg, msgid] = rmdir(outdir, 's');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 if ~success, disp(msg), return, end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 else % check with the user
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 if exist(outdir, 'dir') == 7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 disp('The requested report directory already exists.')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 r = input('Do you want to overwrite it? [y/n] ', 's');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 if strcmpi(r, 'y')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 [success, msg, msgid] = rmdir(outdir, 's');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 if ~success, disp(msg), return, end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 mkdir(outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 mkdir(fullfile(outdir, 'images'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 % Write .html file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 indexFile = fullfile(outdir, 'index.html');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 fd = fopen(indexFile, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 header = getHeader();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 footer = getFooter();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 % write header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 fprintf(fd, header);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 % write description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 desc = find(pl, 'desc');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 if ~iscell(desc), desc = {desc}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 for kk=1:numel(desc)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 fprintf(fd, '<p>%s</p>\n', desc{kk});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 % write index entry
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 fprintf(fd, '<br><h2><a name="toc">Table of Contents</a></h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 [s, htmlfiles] = writeTableOfContents(objs, objnames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 fprintf(fd, s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 % Group plot?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 if ~isempty(groupPlot)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % go through each cell - one plot per cell
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 for kk=1:numel(groupPlot)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 % get objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 group = groupPlot{kk};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 fprintf(fd, '<h2>Plot %d</h2>', kk);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 if isa(group, 'ao')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 imname = 'images/groupplot_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 while exist(fullfile(outdir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 imname = sprintf('images/groupplot_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 % make a plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 hfig = iplot(group);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 saveas(hfig, fullfile(outdir, imname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 fprintf(fd, '<img src="%s" alt="Plot" width="800px" border="3">\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 close(hfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 % write individual html files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 writeObjFiles(fd, objs, htmlfiles, header, footer, outdir, plotOn, saveXML);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 % reportee info
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 fprintf(fd, '<br><h2>report created by:</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 s = obj2table(provenance, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 fprintf(fd, s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 fprintf(fd, '\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 fprintf(fd, '\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 % write footer
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 fprintf(fd, footer);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 % Close
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 % copy stylesheet
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 dp = which('docstyle.css');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 copyfile(dp, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 copyfile(dp, fullfile(outdir, 'html'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 % zip ?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 if compress
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 zip([outdir '.zip'], outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 % open report
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 if isempty(pl.find('dir'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 web(fullfile('file:///', outdir, 'index.html'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 web(fullfile('file:///', pwd, outdir, 'index.html'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 utils.helper.msg(utils.const.msg.PROC1, 'report written to %s', outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 if nargout == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 varargout{1} = outdir;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % Write provenance info
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 function s = obj2table(obj, reportDir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 % prepare table
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 s = sprintf('<p>\n\t');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 s = [s sprintf(' <table border="1" cellspacing="0" cellpadding="0" width="1%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 s = [s sprintf(' <tr valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 s = [s sprintf(' <td align="center" valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 s = [s sprintf(' <table border="0" cellspacing="0" cellpadding="3" width="100%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 s = [s sprintf(' <colgroup>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 s = [s sprintf(' <col width="1%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 s = [s sprintf(' <col width="1%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 s = [s sprintf(' </colgroup>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 s = [s sprintf(' <thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 s = [s sprintf(' <tr valign="top" bgcolor="#000000">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 s = [s sprintf(' <td align="center" colspan="2"><font color="#FFFFFF">%s</font></td></tr>\n', upper(class(obj)))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 s = [s sprintf(' <tr bgcolor="#B2B2B2"valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 s = [s sprintf(' <th>Property</th>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 s = [s sprintf(' <th>Value</th>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 s = [s sprintf(' </thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 s = [s sprintf(' <tbody>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 props = properties(obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 cols = {'#E9E9E9', '#FFFFFF'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 for jj=1:numel(props)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 prop = props{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 val = obj.(prop);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 s = [s sprintf(' <tr valign="top" bgcolor="%s">\n', cols{mod(jj,2)+1})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 s = [s sprintf(' <td><h4><font color="#890022"><i>%s</i></font></h4></td>\n', props{jj})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 %---- EXCEPTIONS -------%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 if isempty(val)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 valstr = '<font color="#0003B6"><i>empty</i></font>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 if strcmp(prop, 'mfile')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 valstr = '<i>see above</i>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 elseif strcmp(prop, 'mdlfile')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 valstr = '<i>SIMULINK model file</i>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 valstr = val2html(val, reportDir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 s = [s sprintf(' <td>%s</td>\n', valstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 s = [s sprintf(' </tbody>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 s = [s sprintf(' </table>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 s = [s sprintf(' </td>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 s = [s sprintf(' </table>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 s = [s sprintf('</p>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 % Convert a MATLAB type to an html string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 function s = val2html(val, reportDir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 MAX_STR_LENGTH = 50;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 MAX_NUM_LENGTH = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 if ischar(val) % String
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 s = ['<font color="#49B64B">' strtrunc(val, MAX_STR_LENGTH) '</font>'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 elseif iscell(val) % Symbol
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 cs = size(val);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 if numel(val) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 s = val2html(val{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 s = '<table border="1" cellpadding="2" cellspacing="0">\n';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 s = [s sprintf(' <thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 s = [s sprintf(' <tr valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 s = [s sprintf('<th bgcolor="#8BCEC3"></th>')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 for jj=1:cs(2) % loop over columns
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 s = [s sprintf('<th bgcolor="#8BCEC3">%d</th>', jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 s = [s sprintf(' </thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 for jj=1:cs(1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 s = [s '<tr>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 s = [s sprintf('<th bgcolor="#8BCEC3">%d</th>', jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 for kk=1:cs(2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 s = [s '<td align="center" valign="middle" >\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 s = [s val2html(val{jj,kk})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 s = [s '</td>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 s = [s '</tr>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 s = [s '</table>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 %%%%%%%% SYMBOLS
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 elseif isa(val, 'sym')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 if numel(val) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 s = strtrunc(char(sym), 50);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 cs = size(val);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 s = '<table border="1" width="600px" cellpadding="3" cellspacing="0">\n';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 s = [s sprintf(' <thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 s = [s sprintf(' <tr valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 s = [s sprintf('<th bgcolor="#B2B2B2"></th>')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 for jj=1:cs(2) % loop over columns
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 s = [s sprintf('<th bgcolor="#B2B2B2">%d</th>', jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 s = [s sprintf(' </thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 for jj=1:cs(1) % loop over rows
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 s = [s '<tr>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 s = [s sprintf('<th bgcolor="#B2B2B2">%d</th>', jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 for kk=1:cs(2) % loop over columns
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 s = [s '<td align="center" valign="middle" >\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 s = [s '<font color="#6969B6">' strtrunc(char(val(jj,kk)),50) '</font>'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 s = [s '</td>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 s = [s '</tr>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 s = [s '</table>\n'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 elseif isa(val, 'ltpda_obj') % LTPDA object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 if isa(val, 'history')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 imname = 'images/hist_img_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 while exist(fullfile(reportDir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 imname = sprintf('images/hist_img_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 dotview(val, plist('filename', fullfile(reportDir, imname), 'view', false, 'format', 'png'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 s = sprintf('<img src="%s" alt="History Plot" border="3">\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 elseif isa(val, 'unit') || isa(val, 'time') || isa(val, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 s = mask_special_char(char(val));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 s = obj2table(val, reportDir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 elseif islogical(val)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 if val
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 s = '<i>true</i>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 s = '<i>false</i>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 elseif isnumeric(val) % Numbers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 if isempty(val)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 s = '<font color="#0003B6"><i>empty</i></font>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 if numel(val) > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 s = [sprintf('<font color="#0003B6"><tt><font color="#000000">[%dx%d]</font>', size(val,1), size(val,2)) mat2str(val(1:min(numel(val), MAX_NUM_LENGTH)), 4)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 s = ['<font color="#0003B6"><tt>' mat2str(val(1:min(numel(val), MAX_NUM_LENGTH)), 4)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 if numel(val) > MAX_NUM_LENGTH
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 s = [s '...'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 s = [s '</tt></font>'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 s = strtrunc(char(val), MAX_STR_LENGTH);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 function txt = Cell2String(c)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 % recursive code to print the content of cell arrays
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 if iscell(c) % for a cell
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 txt = '';%;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 for i=1:size(c,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 if i==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 txti = '{';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 txti = ' ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 for j=1:size(c,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 txti = [txti ' ' Cell2String(c{i,j})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 if i==size(c,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 txti = [txti, ' }'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 txt = strvcat(txt, txti);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 elseif isa(c, 'sym')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 txt = char(c);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 elseif islogical(c) % for a logical
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 txt = mat2str(c);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 elseif isnumeric(c)||isa(c,'sym') % for a numerical array, only size is displayed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 if size(c,1)+size(c,2)==0 % for 0x0 array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 txt = ' [] ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 elseif isa(c,'double') && (norm(c)==0) % for zero array (test dos not carsh for sym)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 txt = ' [] ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 else % for non empty array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 if size(c,1)>9
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 txt1 = ['[',num2str(size(c,1))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 txt1 = [' [',num2str(size(c,1))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 if size(c,2)>9
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 txt2 = [num2str(size(c,2)),']'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 txt2 = [num2str(size(c,2)),'] '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 txt = [txt1,'x',txt2 ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 % txt = mat2str(c); % old display
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 elseif ischar(c)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 txt = ['''' c ''''];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 txt = char(c);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 % Truncate a string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 function s = strtrunc(s, n)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 sl = length(s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 s = s(1:min(sl, n));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 if sl > n
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 s = [s '...'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 s = mask_special_char(s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 % Mask the special characters '<', '>' and &
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 % '<' with '<'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 % '>' with '>'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 % '&' with '&'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 function s = mask_special_char(s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 s = strrep(s, '&' ,'&');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 s = strrep(s, '<', '<');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 s = strrep(s, '>' ,'>');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 % Write a table of contents for the input objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 function [s, filenames] = writeTableOfContents(objs, objnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 filenames = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 % start table
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 s = sprintf('<p>\n\t');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 s = [s sprintf(' <table border="1" cellspacing="0" cellpadding="0" width="20%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 s = [s sprintf(' <tr valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 s = [s sprintf(' <td valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 s = [s sprintf(' <table border="0" cellspacing="0" cellpadding="1" width="100%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 s = [s sprintf(' <colgroup>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 s = [s sprintf(' <col width="1%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 s = [s sprintf(' <col width="1%%%%">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 s = [s sprintf(' </colgroup>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 s = [s sprintf(' <thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 s = [s sprintf(' <tr valign="top">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 s = [s sprintf(' <th bgcolor="#B2B2B2">obj #</th>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 s = [s sprintf(' <th bgcolor="#B2B2B2">link</th>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 s = [s sprintf(' </thead>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 s = [s sprintf(' <tbody>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 cols = {'#E9E9E9', '#FFFFFF'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 nn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 for jj=1:numel(objs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 for kk=1:numel(objs{jj})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 obj = objs{jj}(kk);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 % make filename
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 filenames{nn} = sprintf('obj_%03d', nn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 % write table entry
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 s = [s sprintf(' <tr valign="top" bgcolor="%s">\n', cols{mod(nn,2)+1})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 s = [s sprintf(' <td><font color="#890022">%03d</font></td>\n', nn)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 s = [s sprintf(' <td><a href="index.html#%s">%s [%s]</a></td>\n', filenames{nn}, strtrunc(objnames{nn}, 30), class(obj))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 nn = nn + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 s = [s sprintf(' </tbody>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 s = [s sprintf(' </table>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 s = [s sprintf(' </td>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 s = [s sprintf(' </tr>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 s = [s sprintf(' </table>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 s = [s sprintf('</p>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 function s = getFooter()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 s = '</body>\n</html>\n';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 function s = getHeader()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 s = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 % write HTML header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 s = [s sprintf('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 s = [s sprintf('"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 s = [s sprintf('<html lang="en">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 s = [s sprintf('<head>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 s = [s sprintf('<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 s = [s sprintf('\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 s = [s sprintf('\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 % Page Title
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 pageTitle = ['LTPDA Report from ' datestr(now)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 s = [s sprintf('<title>%s</title>\n', pageTitle)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 s = [s sprintf('<link rel="stylesheet" href="docstyle.css" type="text/css">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 s = [s sprintf('<meta name="generator" content="DocBook XSL Stylesheets V1.52.2">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 s = [s sprintf('<meta name="description" content="Presents details of an LTPDA object.">\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 s = [s sprintf('</head>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 s = [s sprintf('\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 s = [s sprintf('\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 s = [s sprintf('<body>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 s = [s sprintf('<a name="top"><table cellpadding="5" cellspacing="0" width="100%%%%" bgcolor="#F9E767"><tr><td>\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 s = [s sprintf(' <h1 class="title">%s</h1></td></tr></table>\n\n', pageTitle)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 s = [s sprintf('<hr><br></a>\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 % Write html file for each object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 function writeObjFiles(fd, objs, filenames, header, footer, outdir, plotOn, saveXML)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 % Loop over objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 nn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 for jj=1:numel(objs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 for kk=1:numel(objs{jj})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 % get object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 obj = objs{jj}(kk);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 % Object name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 fprintf(fd, '<table width="100%%%%" bgcolor="#F9F19B" cellpadding="5" cellspacing="0"><tr><td>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 fprintf(fd, '<h1><a name="%s">Name: %s</a></h1>\n', filenames{nn}, mask_special_char(obj.name));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 fprintf(fd, '</td></tr></table>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 fprintf(fd, '<p><h3><a href="index.html#top">Back to Top</a></h3></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 fprintf(fd, '<h2>Class: %s</h2>\n', class(obj));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 % Description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 if isprop(obj, 'description')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 fprintf(fd, '<h2>Description</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 if isempty(obj.description)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 fprintf(fd, '<i>none</i>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 fprintf(fd, '<p>%s</p>\n', mask_special_char(obj.description));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 % Additional stuff
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 if plotOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 if isa(obj, 'ao')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 writeAOextras(obj, fd, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 elseif isa(obj, 'miir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 writeMIIRextras(obj, fd, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547 elseif isa(obj, 'mfir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 writeMFIRextras(obj, fd, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 elseif isa(obj, 'pzmodel')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 writePZMODELextras(obj, fd, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 elseif isa(obj, 'ssm')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 writeSSMextras(obj, fd, outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554 % no extras for this type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 % write object table
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 fprintf(fd, '<h2>Object Table View</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561 s = obj2table(obj, outdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 fprintf(fd, s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 fprintf(fd, '<p><h3><a href="index.html#top">Back to Top</a></h3></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 % save XML ?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 if saveXML
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 [path, name, ext] = fileparts(filenames{nn});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 xmldir = fullfile(outdir, 'xml');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 mkdir(xmldir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 xmlfile = fullfile(xmldir, [name '.xml']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 save(obj, xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574 nn = nn + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 end % End loop over objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 end % Loop over object types
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 % Write extra bits for SSM
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 function writeSSMextras(obj, fd, outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 %-----------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 % make dot view
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 fprintf(fd, '<h2>Block Diagram</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 imname = 'images/ssm_img_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 while exist(fullfile(outdir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 imname = sprintf('images/ssm_img_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 dotview(obj, plist('filename', fullfile(outdir, imname), 'view', false, 'format', 'png'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 fprintf(fd, '<p><img src="%s" alt="SSM Diagram" border="3"></p>\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 % Write extra bits for MIIR
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 function writeMIIRextras(obj, fd, outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 %-----------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 % plot response
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 fprintf(fd, '<h2>Response</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 imname = 'images/resp_img_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 while exist(fullfile(outdir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 imname = sprintf('images/resp_img_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 % make a plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 r = resp(obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 hfig = iplot(r);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 if ~isempty(hfig)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 saveas(hfig, fullfile(outdir, imname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624 fprintf(fd, '<p><img src="%s" alt="MIIR Response" width="800px" border="3"></p>\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 close(hfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 fprintf(fd, '<p><font color="#0003B6"><i>empty</i></font></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 % Write extra bits for MFIR
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 function writeMFIRextras(obj, fd, outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 %-----------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 % plot response
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 fprintf(fd, '<h2>Response</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 imname = 'images/resp_img_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 while exist(fullfile(outdir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 imname = sprintf('images/resp_img_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 % make a plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 hfig = iplot(resp(obj));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 if ~isempty(hfig)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 saveas(hfig, fullfile(outdir, imname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653 fprintf(fd, '<p><img src="%s" alt="MFIR Response" width="800px" border="3"></p>\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 close(hfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 fprintf(fd, '<p><font color="#0003B6"><i>empty</i></font></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661 % Write extra bits for pzmodels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663 function writePZMODELextras(obj, fd, outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 %-----------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 % plot response
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669 fprintf(fd, '<h2>Response</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 imname = 'images/resp_img_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 while exist(fullfile(outdir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674 imname = sprintf('images/resp_img_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 % make a plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 hfig = iplot(resp(obj));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679 if ~isempty(hfig)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 saveas(hfig, fullfile(outdir, imname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682 fprintf(fd, '<p><img src="%s" alt="PZMODEL Response" width="800px" border="3"></p>\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 close(hfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 fprintf(fd, '<p><font color="#0003B6"><i>empty</i></font></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689 % Write extra bits for AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 function writeAOextras(obj, fd, outdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 %-------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 % PLOT
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 fprintf(fd, '<h2>Plot</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 imname = 'images/ao_img_001.png';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 n = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699 while exist(fullfile(outdir, imname),'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 n = n + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701 imname = sprintf('images/ao_img_%03d.png', n);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 % make a plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 hfig = iplot(obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 % make image
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 if ~isempty(hfig)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 saveas(hfig, fullfile(outdir, imname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 % make link
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709 fprintf(fd, '<p><img src="%s" alt="AO Plot" width="800px" border="3"></p>\n', imname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 close(hfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 fprintf(fd, '<p><font color="#0003B6"><i>empty</i></font></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 %-------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 % Output of type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717 if ~isempty(obj.hist)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 cmds = hist2m(obj.hist, plist('stop_option', 'full'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 txt = mfile2html(cmds(end:-1:1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 txt = '<p><font color="#0003B6"><i>empty</i></font></p>';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 fprintf(fd, '<hr>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 fprintf(fd, '<h2>History dump</h2>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 fprintf(fd, '<br><p>This is the output of <tt>type(<i>object</i>)</tt></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 fprintf(fd, '<p><div class="fragment"><pre>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 fprintf(fd, '\n%s', txt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 fprintf(fd, '</pre></div></p>\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 % Reformat an mfile contained in a cell array to be output as html
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 function txt = mfile2html(mfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 % add format tags
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 for kk=1:numel(mfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737 % make strings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739 % Mask '&' in the strings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740 mfile{kk} = regexprep(mfile{kk}, '(''[^'']*'')', '${strrep($1, ''&'', ''&'')}');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741 % Mask '>' in the strings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742 mfile{kk} = regexprep(mfile{kk}, '(''[^'']*'')', '${strrep($1, ''>'', ''>'')}');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 % Mask '<' in the strings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 mfile{kk} = regexprep(mfile{kk}, '(''[^'']*'')', '${strrep($1, ''<'', ''<'')}');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 mfile{kk} = regexprep(mfile{kk}, '''([^''\\]*(\\.[^''\\]*)*)''', '<span class="string">''$1''</span>');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 % make comments
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 idx = strfind(mfile{kk}, '%');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 if ~isempty(idx)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749 mfile{kk} = [mfile{kk}(1:idx(1)-1) '<span class="comment">' mfile{kk}(idx(1):end) '</span>'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 % reformat into a big string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 txt = sprintf([repmat('%s\t',1,size(mfile,1)),'\n'],mfile{:});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 txt = strrep(txt, '`', '''');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 % Get Info
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 function ii = getInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 if nargin == 1 && strcmpi(varargin{1}, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 sets = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 pls = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 elseif nargin == 1 && ~isempty(varargin{1}) && ischar(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 sets{1} = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 pls = getDefaultPlist(sets{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 sets = {'Default'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769 pls = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770 for kk=1:numel(sets)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 pls = [pls getDefaultPlist(sets{kk})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 % Build info object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775 ii = minfo(mfilename, 'ltpda_uoh', 'ltpda', utils.const.categories.output, '$Id: ', sets, pls);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776 ii.setModifier(false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777 ii.setOutmin(0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 function plout = getDefaultPlist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 persistent pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 persistent lastset;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784 pl = buildplist(set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 lastset = set;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787 plout = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790 function plo = buildplist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 switch lower(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 case 'default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793 plo = plist('dir', '', 'extras', true, 'desc', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794 'save', false, 'zip', false, 'plots', {}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795 'overwrite', false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 error('### Unknown parameter set [%s].', set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800
|