forked from OHBA-analysis/osl-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osl_report_write.m
45 lines (37 loc) · 1.28 KB
/
osl_report_write.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function report=osl_report_write(report, parent_report)
html=[];
if nargin>1
% add link to parent report (if there is one):
if ~isempty(parent_report)
html=[html '</p><p><a href="' [parent_report.html_fname] '">Back</a>'];
end
end
html=[html '</p><p>' report.title];
if(isfield(report,'logfile'))
plotname = report.logfile(length(report.dir)+2:end);
html=[html '</p><p><a href="' plotname '">Log file</a>'];
end
% add links to sub reports:
if ~isempty(report.sub_reports)
for rr=1:length(report.sub_reports)
%plotname = report.sub_reports{rr}.html_fname(length(report.dir)+2:end);
plotname = report.sub_reports{rr}.html_fname;
html=[html '</p><p><a href="' plotname '">' report.sub_reports{rr}.title ' report</a>'];
end
end
% add any plots
if ~isempty(report.plot_names)
for ii=1:length(report.plot_names)
if isempty(report.plot_names{ii})
% text only
html=[html '</p><p>' report.plot_titles{ii}];
else
plotname = report.plot_names{ii}(length(report.dir)+2:end);
html=[html '</p><p>' report.plot_titles{ii} '<p><img src="' plotname '.' report.fig_format '" width=650 >'];
end
end
end
fid=fopen(report.html_fname,'w');
fprintf(fid,html);
fclose(fid);
end