IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
html_comparison.m
Go to the documentation of this file.
1 %>@ingroup string htmlgen
2 %>@file
3 %>@brief Transforms comparison matrix into HTML
4 %>
6 %
7 %> @param M Square matrix or cell. If cell, may contain either numbers of strings
8 %> @param labels cell of labels
9 %> @param B matrix with 2-bit elements: less significant bit: "flag_better"; most significant bit: "statistically significant?"
10 %> @param cornerstr =''. String to put in the corner
11 %> @return s A string
12 function s = html_comparison(M, labels, B, cornerstr)
13 
14 flag_colour = nargin > 3;
15 
16 
17 funla = @(x) ['<td class="bob"><div class="hec">', iif(isnumeric(x), mat2str(x), x), '</div></td>'];
18 if flag_colour
19  fun = @(x, b) [sprintf('<td class="nu"><div class="%s"><div class="%s">', iif(bitand(b, 1), 'backbet', ''), iif(bitand(b, 2), ' foresig', '')), iif(isnumeric(x), mat2str(x), x), '</div></div></td>'];
20 
21  if iscell(M)
22  M = cellfun(fun, M, num2cell(B), 'UniformOutput', 0);
23  else
24  M = arrayfun(fun, M, B, 'UniformOutput', 0);
25  end;
26 else
27  fun = @(x) ['<td class="nu">', iif(isnumeric(x), mat2str(x), x), '</td>'];
28  if iscell(M)
29  M = cellfun(fun, M, 'UniformOutput', 0);
30  else
31  M = arrayfun(fun, M, 'UniformOutput', 0);
32  end;
33 end;
34 
35 
36 
37 hete = cellfun(funla, labels, 'UniformOutput', 0);
38 
39 
40 corner = '';
41 
42 % Go!
43 s = ['<table class="bo">', 10];
44 
45 s = cat(2, s, sprintf('<tr><td class="bobbor">%s</td>', corner), cat(2, hete{:}), '</tr>', 10);
46 
47 for i = 1:size(M, 1)
48  s = cat(2, s, '<tr><td class="bor"><div class="hel">', iif(isnumeric(labels{i}), mat2str(labels{i}), labels{i}), '</td>', M{i, :}, '</tr>', 10);
49 end;
50 s = cat(2, s, '</table>', 10);
51 
function html_comparison_std(in M, in S, in labels, in B, in cornerstr)
function html_confusion(in CC, in rowlabels, in collabels, in flag_perc, in flag_rejected, in flag_color, in SS)
function html_table_std(in M, in S, in rowlabels, in collabels, in B, in cornerstr)
function html_comparison(in M, in labels, in B, in cornerstr)
function html_table_std_colors(in M, in S, in rowlabels, in collabels, in cornerstr, in minimum, in maximum, in pow)
function iif(in cond, in x1, in x2)