IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
html_table_std.m
Go to the documentation of this file.
1 %>@ingroup string htmlgen
2 %>@file
3 %>@brief HTML table where data items may have associated standard deviations
4 %>
6 
7 
8 %> @param M Square matrix or cell. If cell, may contain either numbers of strings
9 %> @param S (Optional) Matrix of standard deviations. This one must be a matrix
10 %> @param rowlabels cell of row labels
11 %> @param collabels cell of column labels
12 %> @param B matrix with 2-bit elements: less significant bit: "flag_better"; most significant bit: "statistically significant?"
13 %> @param cornerstr =''. String to put in the corner
14 %> @return s A string
15 function s = html_table_std(M, S, rowlabels, collabels, B, cornerstr)
16 
17 if nargin < 5
18  B = [];
19 end;
20 if isempty(S)
21  S = zeros(size(M));
22 end;
23 flag_colour = ~isempty(B);
24 if nargin < 6
25  cornerstr = '';
26 end;
27 
28 
29 
30 funla = @(x) ['<td class="bob"><div class="hec">', iif(isnumeric(x), mat2str(x), x), '</div></td>'];
31 if flag_colour
32  fun = @(x, b, s) [sprintf('<td class="nu"><div class="%s"><div class="%s">', ...
33  iif(bitand(b, 1), 'backbet', ''), ...
34  iif(bitand(b, 2), ' foresig', '')), ...
35  iif(isnumeric(x), mat2str(x), x), iif(s == 0, '', ['&plusmn;', mat2str(s)]), '</div></div></td>'];
36 
37  if iscell(M)
38  M = cellfun(fun, M, num2cell(B), num2cell(S), 'UniformOutput', 0);
39  else
40  M = arrayfun(fun, M, B, S, 'UniformOutput', 0);
41  end;
42 else
43  fun = @(x, s) ['<td class="nu">', iif(isnumeric(x), mat2str(x), x), iif(s == 0, '', ['&plusmn;', mat2str(s)]), '</td>'];
44  if iscell(M)
45  M = cellfun(fun, M, num2cell(S), 'UniformOutput', 0);
46  else
47  M = arrayfun(fun, M, S, 'UniformOutput', 0);
48  end;
49 end;
50 
51 
52 
53 hete = cellfun(funla, collabels, 'UniformOutput', 0);
54 
55 
56 % Go!
57 s = ['<table class="bo">', 10];
58 
59 s = cat(2, s, sprintf('<tr><td class="bobbor">%s</td>', cornerstr), cat(2, hete{:}), '</tr>', 10);
60 
61 for i = 1:size(M, 1)
62  s = cat(2, s, '<tr><td class="bor"><div class="hel">', iif(isnumeric(rowlabels{i}), mat2str(rowlabels{i}), rowlabels{i}), '</td>', M{i, :}, '</tr>', 10);
63 end;
64 s = cat(2, s, '</table>', 10);
65 
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)