How to select a one random letter from a matrix of letters.
조회 수: 4 (최근 30일)
이전 댓글 표시
I have the array.
move = [R ,P, S]
How would I select a random letter from this array.
cmove = ?
Would it look something like this ?:
cmove = move(rand(numel(move)))
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2014년 4월 2일
편집: Azzi Abdelmalek
2014년 4월 2일
move = {'R' ,'P', 'S'}
cmove = move(randi(numel(move)))
or
move ='RPS'
cmove = move(randi(numel(move)))
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!