7
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

matlabでのfigure保存

Posted at

図(figure)の保存は[saveas] (http://www.mathworks.co.jp/jp/help/matlab/ref/saveas.html)や[export_fig](http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig) などがあるが,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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?