How do I terminate "wait" function?
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I want to terminate or interrupt "wait" function if user presses a cancel button in a gui fig.
Here's a part of my code.
% create a dragable box
rect_h=imrect(gca, position);
while (flag)
% wait until user decides and confirms the box
rectPos=wait(rect_h);
% do the rest jobs
...
...
end
I use "while(flag)" to run the loop until user presses a cancel button. If the cancel button is pressed, the flag is set to false. But the code still stays at
rectPos=wait(rect_h);
until user double clicks to confirm the rectangle.
Any good way to terminate the wait function and escape the while loop by pressing just one cancel button?
Thank you for your help in advance.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 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!