利用subplot指令实现一个figure中的多图显示。
subplot使用方法:
subplot(m,n,p)或者subplot(m n p)。
subplot是将多个图画到一个平面上的工具。其中,m表示是图排成m行,n表示图排成n列,也就是整个figure中有m个图是排成一列的,一共m行,如果m=2就是表示2行图。p表示图所在的位置,p=1表示从左到右从上到下的第一个位置。
实现方法
在一个窗口中显示多幅图像,主要有两种方法:
- 用imshow函数显示有subplot函数分割的区域
eg:img1=imread('');img2=imread(''); %读入两副图片
subplot(1,2,1),imshow(img1) %显示这两幅图象
subplot(1,2,2),imshow(img2)
- 用subimage函数显示有subplot函数分割的区域
eg:X1=imread('');X2=imread(''); %读入两副图片
subplot(1,2,1), subimage(X1) %显示这两幅图象
subplot(1,2,2),subimage(X2)