[App Designer]how to make endless loop program.
이전 댓글 표시
I want to create an app that continuously receives input and displays new images.
If I simply put a function that creates an image like below,
while(flag)
function make_image()
end
the program seems to freeze. How should I design it?
댓글 수: 5
Voss
2021년 12월 21일
Make sure there's a drawnow() being called somewhere within the loop.
while(flag)
make_image();
drawnow();
end
Geoff Hayes
2021년 12월 21일
@Jae-Hee Park - why is a while loop needed? When the new data is received, draw the image then. The problem with the while loop is that your code will become "stuck" within it and no other action (GUI button press, callback, etc.) will be called unless you make the loop interruptible by introducing a pause or the drawnow like @Benjamin suggests.
Jae-Hee Park
2021년 12월 22일
Geoff Hayes
2021년 12월 22일
@Jae-Hee Park - consider using a timer to periodically update your image. The timer could have a period of one second (or less) and within its callback, you would make the update (similar to the body of your while loop).
Jae-Hee Park
2021년 12월 23일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!