Clear Filters
Clear Filters

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.

40 views (last 30 days)
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.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 12 Aug 2016
Edited: Azzi Abdelmalek on 12 Aug 2016
A=[0 0 0 1 0 0]
out=any(A)
To check if theye are all equal to 1 use all(A)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!