cubearth
cubearth

Reputation: 1153

Drawing multiple solid color squares in matlab

How can I form one image containing two squares in matlab from a 3 * 2 matrix containing the RGB values? eg: display something like this

Upvotes: 1

Views: 494

Answers (1)

Tobias
Tobias

Reputation: 4074

RGB = [255 0; 0 255; 0 0]; % red and green
rectSize = 50;

imshow([repmat(reshape(RGB(:,1),[1 1 3]),[rectSize rectSize]) repmat(reshape(RGB(:,2),[1 1  3]),[rectSize rectSize])]);

enter image description here

Upvotes: 3

Related Questions