Split a matrix into smaller pieces - help

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 日

1 投票

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 件のコメント

Itachi
Itachi 2012 年 9 月 10 日
編集済み: Itachi 2012 年 9 月 10 日
Thanks, but I want sth like the reshape function to give me var(: , : , i) for each 4x36 matrix. Is there any other way?
Best regards,
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 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

質問済み:

2012 年 9 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by