MATLAB: How to create a button in a pop up that will allow a user to close all figures

handle graphicsMATLAB

I have a simulation tools which calls MATLAB functions. These functions produce many plots. The simulation will not stop until I close all the figures.
Is there a way to add a command in a pop up with a button asking the user if he want to close all the figures? I would like yes/no buttons with all figures closing when the user answers yes.

Best Answer

choice = questdlg('Would you like to close all figures', ...
'Close figures', ...
'Yes','No','No');
switch choice
case 'Yes'
disp('All figures closed')
close all
case 'No'
disp('No figures closed')
end
Related Question