How to convert a matrix into some cells?

1 Ansicht (letzte 30 Tage)
Pooneh Shah Malekpoor
Pooneh Shah Malekpoor am 14 Mai 2021
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

Akzeptierte Antwort

Matt J
Matt J am 14 Mai 2021
Bearbeitet: Matt J am 14 Mai 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

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by