I have an N * N matrix with three different values, for example 0, 0.5, 1. How can I print an image on the screen, each value of which represents a different color? Important: the matrix is ββa loop, so the values ββcan change (I want each matrix to print the matrix).
I tried to use colormap, it worked fine if all three values ββwere in the matrix, but when one or two values ββremained, the colors were changed.
How I want it to work: a matrix with values ββof 0, 0.5, 1 displays a matrix in which each cell contains 0 color black, 0.5 color green, 1 color yellow.
Thanks a lot!
source share