I am trying to determine if there is a nice way, to close all figures in MATLAB, except for one(s) that I determine before hand, are not to be closed. Is there such a way to do this?
I am finding that I am wasting a lot of time chasing down specific stuff to close, every time my MATLAB script runs. Thank you.
You can try this
%figures to keep
figs2keep = [4, 7];
% Uncomment the following to
% include ALL windows, including those with hidden handles (e.g. GUIs)
% all_figs = findall(0, 'type', 'figure');
all_figs = findobj(0, 'type', 'figure');
delete(setdiff(all_figs, figs2keep));
Here's the link to the source
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