Number of zeros in a matrix
이전 댓글 표시
I need to create a function where I have a matrix and the function returns the number of zeros in that matrix. I need to do this using the if condition.
Then write in a .txt file which columns had more than 12 zeros.
Can someone help me out with this?
Thank you very much.
댓글 수: 2
Azzi Abdelmalek
2012년 11월 17일
Why did you need to do it with if condition?
Bob Choy
2012년 11월 17일
채택된 답변
추가 답변 (2개)
Andrei Bobrov
2012년 11월 17일
a - your matrix
number_columns = find(sum(~a) > 12);
Walter Roberson
2012년 11월 18일
numel(M) - nnz(M)
카테고리
도움말 센터 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!