How to concatenate matrix in a loop

3 次查看(过去 30 天)
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?

采纳的回答

KSSV
KSSV 2020-2-26
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 个评论
Nethravathi S
Nethravathi S 2020-2-26
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by