How to use uiwait in GUI
8 次查看(过去 30 天)
显示 更早的评论
I want to use uiwait in my gui to prevent the rest of my script from advancing until the button 'end' is used. However, when I put uiwait in the opening function, it advances anyways. However, it only advances after using two buttons (initializing imfreehand) twice. If I put one more uiwait, the same happens after three times. Two other buttons don't have this effect on advancing the script. Therefore, it seem that these two buttons somehow delete the figure so uiwait advances. However, I can't figure out where, how and why.
Where should I put uiwait to have the desired effect (advancing only after the button 'end' is used)?
2 个评论
采纳的回答
Luna
2019-2-5
figHandle = uifigure(..) % or you can create another object, etc.
waitfor(figHandle); % when end button pressed, put delete to this button's callback and delete figHandle (or close figure inside this callback), so your code will continue after deletion.
% you can apply it any other objects not only figures
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!