Export Matlab figure as PNG?

后端 未结 5 1909
小鲜肉
小鲜肉 2020-12-06 17:22

I need to automatically export figures from Matlab to PNG. My figure has a size of 600x200 px:

hFig = figure(1); 
set(hFig, \'Color\', [1 1 1]); % background         


        
5条回答
  •  盖世英雄少女心
    2020-12-06 17:58

    Amro answer works perfectly, after you generate your figure, set PaperPositionMode to auto and the print size will be the same as screen size.

    set(gcf, 'PaperPositionMode','auto')   
    print('-dpng','test.png')
    

提交回复
热议问题