How to concatenate matrix in a loop

6 vues (au cours des 30 derniers jours)
Nethravathi S
Nethravathi S le 26 Fév 2020
Commenté : Nethravathi S le 26 Fév 2020
Hi,
I am generating a matrix of size (96,13).
This matrix is kept inside a loop with 5 iterations.
This matrix values changes with every iteration.
I want to save this matrix generated at every iteration.
Finally i need to get a matrix of the size (96, 13*5)
Can anybody help?

Réponse acceptée

KSSV
KSSV le 26 Fév 2020
If the size of matrix is same always.
iwant = zeros(95,13,5) ;
for i = 1:5
iwant(:,:,i) = rand(95,13) ;
end
If the size of matrix changes;
iwant = cell(5,1) ;
for i = 1:5
iwant{i} = rand(10) ;
end
  1 commentaire
Nethravathi S
Nethravathi S le 26 Fév 2020
Thanks, It worked.
Size of the matrix is same everytime.
But at last i want to concatenate all the 5 iterations matrix into one matrix.

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

Community Treasure Hunt

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

Start Hunting!

Translated by