怎么用matlab划出像下图所示的方格,然后给每个方格填充不同的颜色,最后以矩阵的形式(比如说RGB)保存生成的图像?
A(:,:,1) = randint(4,4,[0 255]);
A(:,:,2) = randint(4,4,[0 255]);
A(:,:,3) = randint(4,4,[0 255]);
P = uint8(A);
imagesc(P);
axis square;
set(gca,'XTick',[],'YTick',[]);
imwrite(P,'matdata.bmp','bmp'); % p = imread('matdata.bmp'); imagesc(p);