How do I terminate "wait" function?
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
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!