How to set WaitSecs for several durations?

11 次查看(过去 30 天)
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(?);

采纳的回答

Ameer Hamza
Ameer Hamza 2020-10-20
Try this
rs = [1.0 1.5 2.0];
idx = randi(numel(rs));
WaitSecs(rs(idx))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by