1 %>@ingroup
string htmlgen
3 %>@brief HTML table where data items may have associated standard deviations
5 %> This version of HTML table paints each cell with a colour proportional to corresponding element in M
10 %> @param M Square matrix or cell. If cell, may contain either numbers of strings
11 %> @param S Matrix of standard deviations. This one must be a matrix
12 %> @param rowlabels cell of row labels
13 %> @param collabels cell of column labels
14 %> @param cornerstr =
''. String to put in the corner
17 %> @param pow =10. Color
function power. See
internal function cellcolor2()
21 flag_std = nargin > 1 && ~isempty(S);
26 if nargin < 6 || isempty(minimum)
29 if nargin < 7 || isempty(maximum)
32 if nargin < 8 || isempty(pow)
37 funla = @(x) ['<td class="bob"><div class="hec">',
iif(isnumeric(x), mat2str(x), x), '</div></td>'];
38 hete = cellfun(funla, collabels, 'UniformOutput', 0);
40 s = ['<table class="bo">', 10];
41 s = cat(2, s, sprintf('<tr><td class="bobbor">%s</td>', cornerstr), cat(2, hete{:}),
'</tr>', 10);
44 s = cat(2, s, '<tr><td class="bor"><div class="hel">',
iif(isnumeric(rowlabels{i}), mat2str(rowlabels{i}), rowlabels{i}),
'</td>', 10);
46 [fg, bg] =
cellcolor2(M(i, j), minimum, maximum, pow);
48 ssij = [
'±', num2str(S(i, j))];
52 s = cat(2, s,
'<td class="nu" style="background-color: #', bg,
'; color: #', fg,
';">', ...
53 num2str(M(i, j)), ssij,
'</td>', 10);
55 s = cat(2, s,
'</tr>', 10);
57 s = cat(2, s,
'</table>', 10);
60 %=================================================================================================================================
61 %>@brief Calculates a background color based on percentage
63 %> Sqrt improves the color representation, because it makes low values already some color
66 %> - Green and blue: sqrt(value)/sqrt(sum of row)
70 %> @retval [bgcolor] or [bgcolor, fgcolor]
71 function [fg, bg] =
cellcolor2(n, min, max, pow)
88 idx = (n-min)/(max-min)*(N-1)+1;
95 vbg = cm(round(idx), :);
103 % maximum = sqrt(maximum);
109 % bgcolor = [1, [1, 1]*(1-sqrt(n)/maximum)];
111 % bgcolor = [1, 1, 1];
113 % fgcolor = 1-bgcolor;
119 % varargout = {bgcolor};
121 % varargout = {bgcolor, fgcolor};
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 cellcolor2(in n, in min, in max, in pow)
Calculates a background color based on percentage.
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)