I work on matlab and I have a question:
I have a matrix:
M1 = [5000 5000 3000 4000
11000 15000 13000 10000
6000 8000 14000 9000]
And I subtract to this matrix 12000:
M2 = [7000 7000 9000 8000
1000 -3000 -1000 2000
6000 4000 -2000 3000]
I want to change the negative values to red while keeping the other values.
This is what i tried:
M1 = [5000 5000 3000 4000;
11000 15000 13000 10000;
6000 8000 14000 9000];
LmB = 12000;
M2 = LmB - M1;
M2(M2 < 0) = -1;
M2(M2 > 0) = 0;
figure;
imshow(M1, [], 'InitialMagnification','fit');
figure;
imshow(M2, [], 'InitialMagnification', 'fit');
cmap = [1 0 0; 0 0 0; 0 0 0];
% Apply colormap
colormap(cmap);
I have the negative values in red, but i don't know how to keep the other values and not change them in black.
Thanks

