Delete empty cells in 3 dimensional cell array
조회 수: 2 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196432/image.png)
Hello everyone,
I want to delete the empty cells in the cell array of the picture. How do I do it? Thanks in advance!
#Peter
댓글 수: 0
답변 (1개)
dpb
2018년 9월 23일
That's a 2D cell array w/ three columns, not a 3D array.
c=c(~cellfun(@isempty,c));
댓글 수: 2
dpb
2018년 9월 23일
편집: dpb
2018년 9월 23일
No can do.
Even a cell array itself must be rectangular; it can contain variable-length (including 0) elements in a cell but it, itself as the container is not "jagged".
Nor is there a sparse cell array.
Bestest I see you could do would be to save the one column and a corollary variable of column number.
Or, if it's just the display formatting of the empty brackets, could make that a little less obvious by setting all the empty cells to the empty string instead of empty.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!