MATLAB exiting loop in function when using GUI

I have a function (Not the callback function) which runs when a button is clicked and that function will call another function to perform plotting, which is an animation composed by a series of loops. Problem is, after the program is run, it cannot be stopped unless wait till the animation is done or pressing Ctrl+C which then cause the whole .exe to fail and require reopening it.
I want to make a Reset button, so to stop the loop from continuing, but how to pass a new variable from the interrupt to the existing function which is two level above the original stack?
Thank You

Respuestas (1)

Paulo Silva
Paulo Silva el 27 de Mzo. de 2011

0 votos

3 comentarios

Thomas
Thomas el 27 de Mzo. de 2011
Thank you for you reply. But this doesn't solve my problem, coz the demonstration file is showing how to stop a loop if the loop is in the main function file, in which using global variable can solve the problem, in this case, it's the SpSpj file. But my problem is, the loop is two way up the stack of the main function file...
Paulo Silva
Paulo Silva el 27 de Mzo. de 2011
Share the data in another way, use setappdata and getappdata or save the data in the properties of the GUI figure, see the UserData property.
Thomas
Thomas el 27 de Mzo. de 2011
I've tried saving the data in the properties of the GUI figure, like making a invisible static text to store it, but then when i use handles.textbox, it said undefined function handles, apparently the "handles" structure is not passed through the functions; neither getappdata or setappdata work as well

Iniciar sesión para comentar.

Categorías

Más información sobre Animation en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Mzo. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by