How to automatically delete empty cell arrays generated from a script
조회 수: 1 (최근 30일)
이전 댓글 표시
Hey, so I have a script that filters through a large excel spreadsheet and sorts data based on criteria. It returns around 17 files, with each cell being an embedded matrix. However, some of the files are completely empty due to the fact that nothing may fit the certain criteria. How do I code to automatically delete every empty cell array generated?
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2015년 7월 21일
편집: Azzi Abdelmalek
2015년 7월 21일
v={2 3 [] 5}
idx=cellfun(@isempty,v)
v(idx)=[]
댓글 수: 2
James Tursa
2015년 7월 21일
The last part deletes it ... it is a special syntax that MATLAB uses for deleting elements.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!