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.

답변 (1개)

Azzi Abdelmalek
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)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by