While loop executes one additional loop when using appdesigner button to stop loop
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!