How to concatenate matrix in a loop

조회 수: 6 (최근 30일)
Nethravathi S
Nethravathi S 2020년 2월 26일
댓글: Nethravathi S 2020년 2월 26일
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