button unresponsive while running loop

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일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2022b

태그

질문:

2024년 11월 6일

답변:

2024년 11월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by