Assume that a script is running in Matlab. Is there any way to close all figures? (Closing each figure individually is tedious, and since the script is running I cannot add close all
to it.)
I recommend to run such scripts using a command line version of matlab, including the option -noFigureWindows
. If you want to run it in a full matlab UI (which is slower), use a timer object:
t = timer('TimerFcn',@(x,y)(close('all')), 'Period', 10.0);
start(t)
Don't forget to close and delete the timer after finishing your script.
This works for me (tested in R2010b): in Matlab's command prompt, go to the menu bar, select Windows
, then Close All Documents
. This closes all figures, as well as editor files, while an m-file is running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With