How to find the number of ones in each column of a logical matrix?
조회 수: 2 (최근 30일)
이전 댓글 표시
How to find the number of ones in each column of a logical matrix?
댓글 수: 0
채택된 답변
Star Strider
2017년 2월 11일
편집: Star Strider
2017년 2월 11일
Use the sum function.
Example:
A = logical(randi([0 1], 10,5)); % Create Data
Ones_In_Each_Column = sum(A) % Sum The Columns
EDIT — Added ‘Example’ code.
댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!