How to convert a matrix into some cells?

1 回表示 (過去 30 日間)
Pooneh Shah Malekpoor
Pooneh Shah Malekpoor 2021 年 5 月 14 日
Hello
I have a big matrix which i want to convert to equal submatrixces in cell form. As an illustration imagine this matrix:
[1 0 ;
23 13;
1 9;
4 6;
7 13;
0 32]
how can i convert it into a matrix with three matrices in the form of cell?
such as
[{cell1};{cell2};{cell3}] where cell1=[1 0 ; 23 13] and cell2=[1 9;4 6] and cell3=[7 13;0 32] ?
it was a small example, imagine that i do not know how many 2*2 cells are there in the original matrix
Bests

採用された回答

Matt J
Matt J 2021 年 5 月 14 日
編集済み: Matt J 2021 年 5 月 14 日
You can use mat2tiles, which you must Download.
A=[1 0 ;
23 13;
1 9;
4 6;
7 13;
0 32];
Acell = mat2tiles(A,[2,2]);
Acell{:}
ans = 2×2
1 0 23 13
ans = 2×2
1 9 4 6
ans = 2×2
7 13 0 32

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by