How to select a one random letter from a matrix of letters.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giuseppe
am 2 Apr. 2014
Kommentiert: Arjun P Kumar
am 25 Sep. 2020
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 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 2 Apr. 2014
Bearbeitet: Azzi Abdelmalek
am 2 Apr. 2014
move = {'R' ,'P', 'S'}
cmove = move(randi(numel(move)))
or
move ='RPS'
cmove = move(randi(numel(move)))
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!