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일

0 개 추천

Try this
rs = [1.0 1.5 2.0];
idx = randi(numel(rs));
WaitSecs(rs(idx))

댓글 수: 2

Takara Sumoto
Takara Sumoto 2020년 10월 20일
Thank you, it worked!
Ameer Hamza
Ameer Hamza 2020년 10월 20일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

질문:

2020년 10월 20일

댓글:

2020년 10월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by