How to select a one random letter from a matrix of letters.
    2 views (last 30 days)
  
       Show older comments
    
    Giuseppe
      
 on 2 Apr 2014
  
    
    
    
    
    Commented: Arjun P Kumar
 on 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 Comments
Accepted Answer
  Azzi Abdelmalek
      
      
 on 2 Apr 2014
        
      Edited: Azzi Abdelmalek
      
      
 on 2 Apr 2014
  
      move = {'R' ,'P', 'S'}
cmove = move(randi(numel(move)))
or
move ='RPS'
cmove = move(randi(numel(move)))
2 Comments
More Answers (0)
See Also
Categories
				Find more on Creating and Concatenating Matrices in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


