Display font colors in Matlab

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
%# create table
f = figure;
h = uitable('Parent',f, 'Units','normalized', 'Position',[0.05 0.05 0.9 0.9]);

%# set table data
set(h, 'Data',QQQQ) 
+4
source share
1

QQQQ, , . ( ) , .

, QQQQ AAA, . ,

AAA = reshape(strtrim(cellstr(num2str(TTT(:)))), size(TTT));
QQQQ = AAA;

for AAA = reshape... . :

TTT = rand(30,2);
AAA = reshape(strtrim(cellstr(num2str(TTT(:)))), size(TTT));
QQQQ = AAA;
for u = 1:2
   PPP = TTT(1:30, u:u);
   RRR = ( PPP(:) > .5);
   QQQQ(RRR, u) = strcat(...
      '<html><span style="color: #FF0000; font-weight: bold;">', ...
      AAA(RRR, u), ...
      '</span></html>');
end

%# create table
f = figure;
h = uitable('Parent',f, 'Units','normalized', 'Position',[0.05 0.05 0.9 0.9]);

%# set table data
set(h, 'Data',QQQQ) 
+3

All Articles