How to remove empty cells from array
371 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/718494/image.png)
4 个评论
Stephen23
2021-8-23
@Daneisha Blair: yes,
data(cellfun(@isempty,data))=[];
is probably the best way to do this.
回答(1 个)
KSSV
2021-8-23
If C is your cell array, you can remove the empty cells using:
C = C(~cellfun('isempty',C)) ;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Denoising and Compression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!