Dear all; how to check if at least one array in a logical vector is true? for example: A=[0 0 0 1 0 0] and there is at least one ''1'' in this array.
조회 수: 9 (최근 30일)
이전 댓글 표시
Dear all; how to check if at least one array in a logical vector is true? for example: A=[0 0 0 1 0 0] and there is at least one ''1'' in this array.
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2016년 8월 12일
편집: Azzi Abdelmalek
2016년 8월 12일
A=[0 0 0 1 0 0]
out=any(A)
To check if theye are all equal to 1 use all(A)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!