IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
confusion_cell.m
Go to the documentation of this file.
1 %>@ingroup string
2 %>@file
3 %>@brief Transforms matrix into a cell of strings
4 
5 %> @param CC confusion matrix (first column is "rejected")
6 %> @param flag_perc =(auto-detect)
7 function c = confusion_cell(CC, flag_perc)
8 
9 if ~exist('flag_perc', 'var') || isempty(flag_perc)
10  flag_perc = sum(CC(:)-floor(CC(:))) > 0;
11 end;
12 
13 if flag_perc
14  CC = round(CC*10000)/100; % To make 2 decimal places only
15 end;
16 
17 c = num2cell(CC);
18 
19 if flag_perc
20  [n1, n2] = size(c);
21  for j = 1:n1
22  for k = 1:n2
23  c{j, k} = sprintf('%g%%', c{j, k});
24  end;
25  end;
26 end;
function confusion_cell(in CC, in flag_perc)