You can create a matrix in MATLAB with the pixel colors [white red black; cyan green yellow; black blue white]
using the following code:
main.m35 chars2 lines
Note that this assumes you have defined the color values for each of the colors (e.g. white = 1, red = 0, etc.) and that the matrix you want to create is a 3x3 matrix as shown. If the color values are not defined, you can assign them using the following code:
main.m74 chars8 lines
Then you can create the matrix using the code above.
gistlibby LogSnag