how is it possible to assign certain color to a value from matrix.
For example I have a 10by10 matrix with values from 0 to 9.
Afterwards I’d like to get a “chess board” where 0 = white, 1 = black, 2 = blue…etc…
2nd question
if I run some operations where my matrices change with each loop and I run let’s say 10 lops (k = 10) – is it possible to make a video out of this 10 plot pictures I’ll be getting after each loop. (I’m programming some kind of cellular automaton, so I’d like to see how the situation changes over time).
Thanks
Consider this example:
You can use a custom colormap, simply create a matrix
cmapof size 10-by-3, each row contains the RGB values, and pass it to the callcolormap(cmap)For MATLAB versions older than R2010b, you can use the avifile function, instead of VideoWriter: