i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column
이전 댓글 표시
i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column
답변 (1개)
Andrei Bobrov
2012년 9월 24일
A = rand(10,1) > .6; % The initial vector - column
out = sum(~A);
or
out = nnz(~A);
댓글 수: 1
Raghavendra
2012년 9월 24일
yes its perfect:) thanks for the info:)
카테고리
도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!