필터 지우기
필터 지우기

Concatenation for a large number of 2D matrices

조회 수: 1 (최근 30일)
padoh
padoh 2013년 8월 19일
i have around 151 2D matrices that i have to concatenate to form a 3D matrices. one option is to use the command c=cat (3,A1,A2,A3,A4,A5.......,A151). Is there an easier way to do it using some loop.

답변 (1개)

David Sanchez
David Sanchez 2013년 8월 19일
It all depends on how your matrices are named, assuming they all have the same size (number of rows and cols). If your matrices are within a cell array where each cell contains a matrix:
big_mat = zeros(rows,cols, 3);
for k = 1:151
big_mat(:,:,k) = A{k};
end
  댓글 수: 1
padoh
padoh 2013년 8월 19일
편집: padoh 2013년 8월 19일
thank you vbery much. but can u plz add some comments so that i can change the code to suit my requirements?
Besides matlab is indicating an error at the third line..can u plz help

댓글을 달려면 로그인하십시오.

카테고리

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