Closing GUI without error
Show older comments
In my GUI I have a simulation that runs with a while loop. Problem is when I close the window while it's still running, matlab gives me an error message of the sort:
Error using matlab.ui.control.UIControl/get
Invalid or deleted object.
Error in SPCgui>startrestart_Callback (line 376)
if get(handles.pauseresume,'Value')==1
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in SPCgui (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)SPCgui('startrestart_Callback',hObject,eventdata,gu idata(hObject))
Error while evaluating DestroyedObject Callback
Is there a way to force a loop to stop when I close the window so that this error doesn't occur? I tried using figure1_DeleteFcn and figure1_CloseRequestFcn to no avail.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!