While loop executes one additional loop when using appdesigner button to stop loop
Show older comments
Hi All,
I am trying to build a app to count the number of circles in a image manually using the drawpoint and display the count. The code is working with the drawpoint and displaying the count but when i try to stop the loop with the stop button (break command) is executes one more drawpoin and circle count. So i get a unwanted additional point on the image and additional count in the display.
Code:
% Button pushed function: StartCountTslotButton
function StartCountTslotButtonPushed(app, event)
app.cctb = 0;
app.n = 0;
app.EditField3.Value = app.cctb;
while app.cctb==0
app.n=app.n+1;
app.h = drawpoint("Parent",app.image);
app.TSlotCond.Value = app.n;
if app.cctb==1
break
end
end
end
% Button pushed function: CompTslotButton
function CompTslotButtonPushed(app, event)
app.cctb=1;
app.EditField3.Value = app.cctb
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!