matlab保存图片空白间隔,所见即所存

%设置空白间隔
margin = get(gca, 'TightInset'); 
set(gca, 'Position', [0+margin(1) 0+margin(2) 1-margin(1)-margin(3) 1-margin(2)-margin(4)]); 
 
%设置全屏
set(gcf, 'position', get(0,'ScreenSize'));
 
%设置所见即所存
pos = get(gcf,'Position')
  set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
print(gcf,'test.jpg','-djpeg','-r0')

你可能感兴趣的:(matlab保存图片空白间隔,所见即所存)