Split a matrix into smaller pieces - help

조회 수: 1 (최근 30일)
Itachi
Itachi 2012년 9월 10일
Hi guys, I have a 16x36 matrix and I want to divide it into 4x36 submatrixes. I used reshape(matrix,4,[],4) but the order of elements got wrong. Any ideas?
Best regards,

채택된 답변

Matt Fig
Matt Fig 2012년 9월 10일
편집: Matt Fig 2012년 9월 10일
A = reshape(1:36*16,16,36);
B = mat2cell(A,[4 4 4 4],36);
Now you have each submatrix stored in a cell of B. For example, B{1} is:
B{1}
  댓글 수: 3
Matt Fig
Matt Fig 2012년 9월 10일
편집: Matt Fig 2012년 9월 10일
With A as above:
B = permute(reshape(A.',36,4,4),[2,1,3])
Itachi
Itachi 2012년 9월 10일
편집: Itachi 2012년 9월 11일
Thanks.

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

추가 답변 (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