MATLAB中figure的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/T_I_A_N_/article/details/84433026

一、使MATLAB不显示figure界面:

h=figure
set(h,‘Visible’,‘off’);

二、MATLAB图片批量保存并分别命名

figure('visible','off'); 

——————————————————————————————————————————

%以下代码是绘制三张图片

subplot(1,3,1);imshow(ReconEnhanced(floor(sizey/2+0.5-sizey/8):ceil(sizey/2+0.5+sizey/8),:),[],'InitialMagnification','fit','border','tight','Colormap',GEColormap);

subplot(1,3,2);imshow(ReconEnhanced(floor(sizey/2+0.5-sizey/8):ceil(sizey/2+0.5+sizey/8),:),[],'InitialMagnification','fit','border','tight','Colormap',GEColormap);
    

subplot(1,3,3);imshow(ReconEnhanced(floor(sizey/2+0.5-sizey/8):ceil(sizey/2+0.5+sizey/8),:),[],'InitialMagnification','fit','border','tight','Colormap',GEColormap);

——————————————————————————————————————————

i=cputime;   %我为了区分保存的先后顺序,使用了系统时间,

saveas(gcf,['D:\changeView\',num2str(i),'.jpg']);

print(2,'-djpeg',['D:\',num2str(i),'.jpg']);%功能同上

三、MATLAB中figure去白边

imshow(strain_image,'border','tight','initialmagnification','fit');
%'border','tight'的组合功能意思是去掉图像周边空白
%'InitialMagnification','fit'组合的意思是图像填充整个figure窗口

 四、matlab一次读取多张图片

im = {};
dis = dir('D:\changeView\*.jpg');
for i = 1:length(dis)
path = strcat('D:\changeView\',dis(i).name);
im{i}=imread(path); %%将读取
imshow(im{i}) %%为了同时显示多幅图片,不加figure的话只会显示一副图片,因为读入的第i副图片会被第i+1副图片覆盖 
end

猜你喜欢

转载自blog.csdn.net/T_I_A_N_/article/details/84433026