button unresponsive while running loop

22 ビュー (過去 30 日間)
Rohit
Rohit 2024 年 11 月 6 日 10:04
回答済み: Gayatri 2024 年 11 月 6 日 10:41
I have a button that toggles the state of a rogue variable which will terminate a while loop. However, if the while loop is running, the button is unresponsive, and I cannot break the loop without using "ctrl + C".

回答 (1 件)

Gayatri
Gayatri 2024 年 11 月 6 日 10:41
Hi Rohit,
You can use 'drawnow' or one of its functional equivalents, such as 'pause(0)' inside of the while loop when it is running and button is unresponsive.
Adding this allows the system to register that the variable has updated, which subsequently breaks the loop.
Please refer the following documentation for drawnow function: https://www.mathworks.com/help/matlab/ref/drawnow.html

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by