How to save a figure in MATLAB from the command line?

后端 未结 7 1119
灰色年华
灰色年华 2020-12-13 09:16

Is there a command in MATLAB which allows saving a figure in FIG or JPEG or both formats automatically?

7条回答
  •  孤街浪徒
    2020-12-13 09:32

    When using the saveas function the resolution isn't as good as when manually saving the figure with File-->Save As..., It's more recommended to use hgexport instead, as follows:

    hgexport(gcf, 'figure1.jpg', hgexport('factorystyle'), 'Format', 'jpeg');
    

    This will do exactly as manually saving the figure.

    source: http://www.mathworks.com/support/solutions/en/data/1-1PT49C/index.html?product=SL&solution=1-1PT49C

提交回复
热议问题