I have a matrix N*N, with three different values, for example 0, 0.5, 1.
How can i print to the screen an image, which each value represent a different color?
Important: the matrix is a loop so the values may change (i want to print the matrix every iteration).
I tried to use colormap, it worked fine if all the three values were in the matrix,
but when one or two values only remain, the colors were changed.
How I want it to work: matrix with values 0, 0.5, 1 prints to the screen a matrix which each cell contains 0 colored black, 0.5 colored green, 1 colored yellow.
Thanks a lot!
Just create your own colormap that has only three possible values:
a gives:
b gives: