Can I use a button to stop a GUI and the function and the script that started it?
Show older comments
Hello I'm sorry if there is an answer out there but I haven't been able to find it. I have a script which runs a script which calls a function which launches a GUI. Is it possible to have a button in the GUI that will exit the GUI, the function, and the script (basically an abort button)?
To exit the GUI I have: delete(handles.figure1) return;
but it seems that "return" runs the gui exit code because I get the following error when I hit the button:
??? Attempt to reference field of non-structure array.
Error in ==> a2_QueryLoopGUI>a2_QueryLoopGUI_OutputFcn at 74
varargout{1} = handles.output;
Any ideas? Do I have to pass an exit variable out through varargout to the function and then from the function into the script?
Thanks!
Answers (1)
Sean de Wolski
on 29 Mar 2012
0 votes
Sure.
Have the GUI, on exit by pushing a quit button (or the red 'x'), return a flag that when returned, is checked for in the function, which return from the function etc.
Or just have it throw an error.
3 Comments
Ben Ruppel
on 29 Mar 2012
Ben Ruppel
on 29 Mar 2012
Josh Philipson
on 12 Nov 2015
Ben, Thanks for posting this.
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!