How can I choose one element form a row array randomly?

Good morning, I'm interested in choosing only one element from an array. e.g. i got the following array T=[0 1 2 3 4 5] but I want to get one element from it randomly. Thanks for your attention.

 채택된 답변

James Tursa
James Tursa 2018년 5월 17일
편집: James Tursa 2018년 5월 17일
result = T(randi(numel(T)));

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by