How can i prevent a GUI from closing?

I am currently creating a Graphical User Interface with several pushbuttons. When selecting one of the buttons, the GUI closes and runs an m file (opens an image, permits the user to select points on it and saves the data into a separate file). How can I prevent the GUI from closing as I want to use another button to perform further operations with that saved data?

Answers (1)

Set the figure's CloseRequestFcn to [];
h = figure;
surf(peaks);
set(h,'CloseRequestFcn',[]);
Note, this isn't fool proof, the CloseRequestFcn could be set back to the default or a:
close all force
would clean it out as well.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

Asked:

on 15 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!