From: Jochen Bardong on
To display my measurement data in time and frequency domain, i use the function 'spectrogram'. To be able to continue working on my computer while my analysis program is running, i run matlab in headless mode so that no figure windows pop up and block my screen.
While saving only line plots, matlab works just fine and produces the graphs in all needed file formats (*.fig, *.png, *.tif and *.eps).
When it comes to save the spectrogram, the *.fig file is made, but the next file format in line (does not matter which one of those above, I tried each of those separately), matlab crashes reproducibly.
My system is Windows 7 x64 with 4 Gigabyte of RAM running the 64 bit version of Matlab 2009b SP1.

I first thought, i cannot use the "saveas" command in headless mode, but for the simpler plots, it works. But nevertheless I tried the "print" command as well for the non - *.fig - file types and again, matlab crashes.

Is there a possibility either to determine if matlab is in headless mode so I can switch off the other file types via IF/ELSE statement or can I switch between headless mode and "normal mode" in run-time to activate figures while the spectrograms are saved and then get back to headless mode?

This was my first part of the problem.
The second is the following:
During this analysis, many files are batch-processed so a lot of figures are generated of which I want to make a movie, e.g. an *.avi file. In normal mode, everything works just fine, but in headless mode, again, matlab crashes when it tries to capture the first frame. I use the commands "avifile" , "getframe" and "addframe".

Will I have to stick with normal mode or is there a chance to a) suppress the figure output during processing and b) make the movies?

Thanks a lot!