How to convert matrix to cell array?

4 vues (au cours des 30 derniers jours)
SRI
SRI le 11 Août 2019
Modifié(e) : SRI le 11 Août 2019
I have 4*140 double matrix ,and now i want to convert this matrix into 1*35 cell array,in that each cell contains 4*4 double cell

Réponse acceptée

Bruno Luong
Bruno Luong le 11 Août 2019
Modifié(e) : Bruno Luong le 11 Août 2019
c = mat2cell(A,4,4*ones(1,35))
If you want nested cell as well, do that after the above
c = cellfun(@num2cell, c, 'unif', 0)
Be aware, cell is innefficient to work with.
  1 commentaire
SRI
SRI le 11 Août 2019
Modifié(e) : SRI le 11 Août 2019
c = mat2cell(A,4,4*ones(1,35)) % this command line works me sir
c = cellfun(@num2cell, c, 'unif', 0) % wow ,i understand very clearly this command line
Thanks a lot sir ,we done a great job to me.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by