Effacer les filtres
Effacer les filtres

How to convert a matrix into some cells?

1 vue (au cours des 30 derniers jours)
Pooneh Shah Malekpoor
Pooneh Shah Malekpoor le 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

Réponse acceptée

Matt J
Matt J le 14 Mai 2021
Modifié(e) : Matt J le 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

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by