Showing posts with label matlab basics. Show all posts
Showing posts with label matlab basics. Show all posts

Thursday, January 20, 2011

Matlab-4 Display multiple images, plots in a single window in MATLAB

How to display multiple images or graphs in a single window (frame) in MATLAB


This is done by using the subplot command in MATLAB

Suppose we have to display 4 images (aa,bb,cc,dd) in a single figure and arrange them in 2x2 fashion.

We will use the following commands:

figure;

subplot(2,2,1);imshow(aa);
subplot(2,2,2);imshow(bb);
subplot(2,2,3);imshow(cc);
subplot(2,2,4);imshow(dd);


similary to display two image in 2x1 fashion, we will use:

subplot(2,1,1);imshow(aa);
subplot(2,1,2);imshow(bb);