How to set WaitSecs for several durations?

I would like to set WaitSecs for several duration such as 1.0s, 1.5s, and 2.0, and randomize them.
How should I write a code?
rs = randperm(3);
WaitSecs(?);

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 20 de Oct. de 2020
Try this
rs = [1.0 1.5 2.0];
idx = randi(numel(rs));
WaitSecs(rs(idx))

2 comentarios

Takara Sumoto
Takara Sumoto el 20 de Oct. de 2020
Thank you, it worked!
Ameer Hamza
Ameer Hamza el 20 de Oct. de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Oct. de 2020

Comentada:

el 20 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by