How to remove empty cells from array
Mostrar comentarios más antiguos
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 comentarios
Stephen23
el 23 de Ag. de 2021
@Daneisha Blair: currently you have a 151x11 cell array.
What shape/size do you expect to get once all of the empty cells are removed?
Daneisha Blair
el 23 de Ag. de 2021
Daneisha Blair
el 23 de Ag. de 2021
Stephen23
el 23 de Ag. de 2021
@Daneisha Blair: yes,
data(cellfun(@isempty,data))=[];
is probably the best way to do this.
Respuestas (1)
KSSV
el 23 de Ag. de 2021
If C is your cell array, you can remove the empty cells using:
C = C(~cellfun('isempty',C)) ;
Categorías
Más información sobre Surfaces, Volumes, and Polygons en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!