How to convert a matrix into some cells?

1 view (last 30 days)
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

Accepted Answer

Matt J
Matt J on 14 May 2021
Edited: Matt J on 14 May 2021
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

More Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!