Help us understand the problem. What is going on with this article?

matlabでのfigure保存

More than 5 years have passed since last update.

図(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')

jellied_unagi
Python and Matlab tips for computer vision
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away