I am trying to create an array of numbers (converted to a string) that is lower than the given value, for my current testing I use 0.5. I need a font for each value of my table that falls above or below my value so that it is colored red, in my current code I use only 2 columns, but I will use more than 10. This is my code right now and it only displays values of numbers above 0.5 in red, but do not display numbers below 0.5 (they must be black). I apologize for the wrong variable name, I'm just testing this. Help would be greatly appreciated.
TTT = rand(30,2);
for u = 1:2
PPP = TTT(1:30, u:u);
RRR = ( PPP(:) > .5);
AAA = reshape(strtrim(cellstr(num2str(TTT(:)))), size(TTT));
QQQQ(RRR, u) = strcat(...
'<html><span style="color: #FF0000; font-weight: bold;">', ...
AAA(RRR, u), ...
'</span></html>');
end
%
f = figure;
h = uitable('Parent',f, 'Units','normalized', 'Position',[0.05 0.05 0.9 0.9]);
%
set(h, 'Data',QQQQ)
source
share