How to select a one random letter from a matrix of letters.

3 visualizaciones (últimos 30 días)
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)))

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 2 de Abr. de 2014
Editada: Azzi Abdelmalek el 2 de Abr. de 2014
move = {'R' ,'P', 'S'}
cmove = move(randi(numel(move)))
or
move ='RPS'
cmove = move(randi(numel(move)))
  2 comentarios
Giuseppe
Giuseppe el 2 de Abr. de 2014
is there a way to remove those quotation marks
Arjun P Kumar
Arjun P Kumar el 25 de Sept. de 2020
You can find them without quotation in the workspace

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by