I have used the following code to convert RGB images to indexed image and stack them as a cube
[D,map] = rgb2ind(A,256);
E = rgb2ind(B,map);
F = rgb2ind(C,map);
G = zeros(size(A,1),size(A,2),3)
The indexed image is viewed using the code
In a similar manner, how can I view my cube G using the same colormap?