How to generate different variables to store different sets of matrix?

1 vue (au cours des 30 derniers jours)
Patrick
Patrick le 15 Nov 2014
Commenté : Star Strider le 15 Nov 2014
Using for loop, 35 different matrices are generated in my codes. How can I generate 35 different variables to store them respectively?

Réponse acceptée

Star Strider
Star Strider le 15 Nov 2014
Just DON’T!
Create a multidimensional matrix, or if your matrices are different sizes, use a cell array.
  4 commentaires
Patrick
Patrick le 15 Nov 2014
Thanks man, my problem is resolved!
Star Strider
Star Strider le 15 Nov 2014
My pleasure!
If you want to call the matrix created at iteration 20 of the loop, you can refer to it as:
M(:,:,20)
However if you want to do calculations with it, it’s sometimes easier to create a separate temporary matrix for it, for instance:
Mt = M(:,:,20);
to avoid having to write all the subscripts each time you use it in your calculations.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by