getting rid of empty cells in a cell array
Afficher commentaires plus anciens
Hi,
can you please help me with this? I have the following cell array
x = {1,[],'ciao',[],[]};
I want to exclude the empty cells, and get another array like this:
y = {1,'ciao'};
Thank you!
Réponse acceptée
Plus de réponses (1)
Mischa Kim
le 15 Jan 2014
Modifié(e) : Mischa Kim
le 15 Jan 2014
3 votes
Try y=x(~cellfun('isempty',x))
4 commentaires
Sebastiano delre
le 15 Jan 2014
Kanthaswamy Ganapathy
le 4 Mai 2021
Thank you . How do I extend this to work for a n-d cell array
Yiqian Qian
le 27 Mai 2021
I have the same question above, how to apply this to a specific row or colums.
Nisha Bharti
le 10 Oct 2021
Yes, same query
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!