How to remove empty cells from array

122 vues (au cours des 30 derniers jours)
Daneisha Blair
Daneisha Blair le 23 Août 2021
Commenté : Stephen23 le 23 Août 2021
Hi,
I'm very new to matlab :)
How can I remove the empty cells from the array in the attached image?
I have tried data(~cellfun('isempty',data)), but this didn't work.
Thank you for the help.
  4 commentaires
Daneisha Blair
Daneisha Blair le 23 Août 2021
I figure it out :), data(cellfun(@isempty,data))=[]; works.
Thanks!
Stephen23
Stephen23 le 23 Août 2021
@Daneisha Blair: yes,
data(cellfun(@isempty,data))=[];
is probably the best way to do this.

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 23 Août 2021
If C is your cell array, you can remove the empty cells using:
C = C(~cellfun('isempty',C)) ;

Catégories

En savoir plus sur Surfaces, Volumes, and Polygons 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