How to select a one random letter from a matrix of letters.
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Giuseppe
      
 el 2 de Abr. de 2014
  
    
    
    
    
    Comentada: Arjun P Kumar
 el 25 de Sept. de 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 comentarios
Respuesta aceptada
  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
Más respuestas (0)
Ver también
Categorías
				Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



