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

后端 未结 7 1068
灰色年华
灰色年华 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:44

    These days (May 2017), MATLAB still suffer from a robust method to export figures, especially in GNU/Linux systems when exporting figures in batch mode. The best option is to use the extension export_fig

    Just download the source code from Github and use it:

    plot(cos(linspace(0, 7, 1000)));
    set(gcf, 'Position', [100 100 150 150]);
    export_fig test2.png
    

提交回复
热议问题