LoginSignup
7
10

More than 5 years have passed since last update.

matlabでのfigure保存

Posted at

図(figure)の保存はsaveasexport_fig などがあるが,print が個人的には一番使いやすかったという話.こちらのページを参考にしました.

SaveImage.m
function [  ] = SaveImage( H, width, height, filename )
%SAVEIMAGE save an image specified by figure handle H using print command

set(H,'PaperPositionMode','auto')
pos=get(H,'Position');
pos(3)=width; 
pos(4)=height;
set(gcf,'Position',pos);
print('-r0','-dpng', filename);

end

使ってみる

>> logo;
>> h=figure(1) % ハンドルの指定

h =

     1

>> SaveImage(h,600,600,'logo.png')

7
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
10