Two while or for loop in app designer.

5 views (last 30 days)
Jae-Hee Park
Jae-Hee Park on 2 Jun 2022
Commented: Geoff Hayes on 3 Jun 2022
Hi
I am looking for a way for cancle running loop when a button cliked.
For a example there is a code below.
When I clicked the button1 then cliked the button2, something works2 is on going.
But something works2 is returned, the something works1 is on going.
When button 1 is clicked and button 2 is clicked, I want something works1 to stop and something works2 to start.
How can I do this?
function button1Clicked(app, event)
while(1)
%something works1
if ?
return;
end
end
end
function button2Clicked(app, event)
while(1)
%something works2
if ?
return;
end
end
end
  2 Comments
Geoff Hayes
Geoff Hayes on 3 Jun 2022
@Jae-Hee Park - or consider using a a timer to perform the repeated actions (instead of a loop) then just stop the timer when the appropriate button is pushed.

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer 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!

Translated by