how to count the number of empty cells in an array?
조회 수: 38 (최근 30일)
이전 댓글 표시
채택된 답변
Muthu
2020년 4월 20일
Hello Sarah,
You can count the empty cells using the following commands
N_nonempty = find(~cellfun(@isempty,Out));
count_empty = length(Out)-length(N_nonempty);
댓글 수: 2
Stephen23
2020년 4월 21일
Much simpler and more efficient just to count the output of cellfun directly:
>> nnz(cellfun(@isempty,Out))
ans = 216
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!