Split a matrix into smaller pieces - help

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by