Borrar filtros
Borrar filtros

How to wait for an button event with a timeout?

5 visualizaciones (últimos 30 días)
Marta
Marta el 19 de Nov. de 2015
Comentada: Marta el 3 de Dic. de 2015
Hi!
I am looping in time through a series of images and I want to give a chance for the user to interact with them between updates. However, I do not want to ask the user at every single update whether they want to interact or not. Ideally I would like to implement something like this:
figure
for t=tini:tfin
imagesc(squeeze(ima(:,:,t))
waitforbuttonpress_for_no more_than_200_ms;
if there_was_a_buttonpress
do_something_to_figure;
end
end
Can you help? Many thanks,
Marta

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Nov. de 2015
  1 comentario
Marta
Marta el 3 de Dic. de 2015
This is exactly what I needed, Walter, many thanks!

Iniciar sesión para comentar.

Más respuestas (1)

dpb
dpb el 19 de Nov. de 2015
  2 comentarios
Marta
Marta el 19 de Nov. de 2015
And how is the event tracked during the pause?
dpb
dpb el 19 de Nov. de 2015
"I don't do windows" <:) so I'm certainly not the best to ask but don't use waitforbuttonpress, set a callback function for the figure instead.
Seems like a reasonable enhancement request to TMW to add a timeout to it, however, maybe.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by