How to select a one random letter from a matrix of letters.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Giuseppe
le 2 Avr 2014
Commenté : Arjun P Kumar
le 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 commentaires
Réponse acceptée
Azzi Abdelmalek
le 2 Avr 2014
Modifié(e) : Azzi Abdelmalek
le 2 Avr 2014
move = {'R' ,'P', 'S'}
cmove = move(randi(numel(move)))
or
move ='RPS'
cmove = move(randi(numel(move)))
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!