[App Designer]how to make endless loop program.

32 visualizaciones (últimos 30 días)
Jae-Hee Park
Jae-Hee Park el 21 de Dic. de 2021
Respondida: Jae-Hee Park el 23 de Dic. de 2021
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 comentarios
Geoff Hayes
Geoff Hayes el 22 de Dic. de 2021
@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).

Iniciar sesión para comentar.

Respuesta aceptada

Jae-Hee Park
Jae-Hee Park el 23 de Dic. de 2021
Geoff Hayes 2021년 12월 21일 13:12
@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.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by