How can i stop the loop iteration using pushbutton callback in MATLAB GUI?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
VBBV
am 27 Nov. 2018
Kommentiert: Roche de Guzman
am 20 Jan. 2021
I have GUI which has pushbutton to stop the for loop iteration. the code structure for stop button callback is follows
g = 1
handles.g = g
guidata(hObject,handles)
When i press the button, it sets the value of g = 1;
In the iteration loop, i have passed the updated value of g using
g = handles.g
and issuing a condition to stop the loop iterations
if g == 1
return
end
however, the iteration loop does not stop, since the value of g resets to 0
why does this happen ?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 28 Nov. 2018
I have a very small demo that does exactly that. It start counting, then when you press stop, it stops counting and updating the text label on the GUI. Then when you press Go, it starts counting and updating the label again.
1 Kommentar
Roche de Guzman
am 20 Jan. 2021
I tried doing a similar process in MATLAB app but the changing of user data to true (1) only happens after the iteration (on queue). I have attached the mlapp file.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!