How to produce two 3*3 random matix for two varible
    3 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Of course,we can use this method
>> matrix1=randi(10,3)
matrix1 =
     3     3     7
     8     1     6
     2     6     5
>> matrix2=randi(10,3)
matrix2 =
     7     7     8
     7    10     3
     7     3     2
Then the variable both matrix1 and matrix2 is random matrix.But I don't like this repetition work.If I'm in Mathematica,I just run
{matrix1, matrix2} = RandomInteger[10, {2, 3, 3}]
Then I get two 3*3 matrix. Matlab can conveniently to do such thing or is there any more elegant method?
0 commentaires
Réponses (2)
  Walter Roberson
      
      
 le 9 Juil 2017
        There is no convenient way to do this in MATLAB.
You can create a variable and use mat2cell to break it into two cell locations. You need to assign that to a variable. Then you can use deal() to split the variable by taking advantage of comma list expansion. If you were doing this more than once you would want to write a function to do it.
0 commentaires
Voir également
Catégories
				En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

