So I've got a 10x10 matrix randMat that has random integers between 1 and 4 and another array map of zeros which is to have the RGB values for four colors i.e. a row for each color and three columns for the amounts of red, green, and blue.
randMat = randi(4,10)
map = zeros(4,3);
Using a for loop I've assigned to each row of map the RGB values for a shade of red with red values from 1/4 to 4/4 = 1. So each row should have a red value of i/4 and blue and green values of zero. I've also made map the colormap
for i=1:4
map(i,1) = i/4;
end
colormap(map);
Now the problem is I want to visualize randMat in 4 shades of red but it keeps showing up as blue. What am I missing?
image(randMat)
axis off
axis square
colormap(map), or you can write thecolormapafterimage(randMat)- Adiel