How to select a one random letter from a matrix of letters.
3 次查看(过去 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!