MATLAB: How to close the GUI from a message box callback

boxcloseguiMATLABmessage

I would like to be able to use a message box callback to close my GUI.

Best Answer

You can create the msgbox and pass the handle of the figure into the callback of the DeleteFcn in the following manner:
h=msgbox('Goodbye')
set(h,'deleteFcn',{'test', gcf})
The callback of the DeleteFcn can be defined to be:
function test(src, eventdata, k)
close(k); % Close the figure
close(gcbf); % close the message box