Is it possible to save a figure when MATLAB is running with "-nodisplay" option?

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?

 Accepted 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')

1 Comment

What if I tried this and when I attempt to reload the figure it says:
Error using ==> open at 162
There is no 'WindowStyle' property in the 'contourgroup' class.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!