MATLAB: By using uint8 function , just converted the image into a plane, but i got the output in gray scale format. is it possible to get the image in rgb format n the same plane

grayrgbuint8

For analysis of am image I just changed the image to r,g and b format by using
ip(1:hi, 1:wi) = i(:,:,1);
ip(1+2*hi:3*hi,1:wi) = i(:,:,2)
ip(1+4*hi:5*hi,1:wi) = i(:,:,3)
command to place the image on a plane, but the output I am receiving is in the grayscale how can I obtain it in the same r , g, b order by eliminating the remaining colour correspondingly ?

Best Answer

ip(1:hi, 1:wi, 1) = i(:,:,1);
ip(1+2*hi:3*hi,1:wi, 2) = i(:,:,2);
ip(1+4*hi:5*hi,1:wi, 3) = i(:,:,3);