MATLAB: Is it possible to save a figure when MATLAB is running with “-nodisplay” option

figureMATLABnotrunningsavex-server

I have MATLAB running with "-nodisplay" flag and I have created a figure which is not displayed.
I start MATLAB without display by using the following command in the Linux terminal window:
matlab -nodisplay
I create figure by using the following command in MATLAB Command Window:
plot(1:10)
This figure is not displayed. Can I save it to a file in FIG or other format nevertheless?

Best Answer

It is possible to save a figure even if it is not displayed. You can use the commands HGSAVE or PRINT to save the figures to a particular format, using GCF or other figure handle. For example,
hgsave('filename')
hgsave(h,'filename')
Related Question