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 次查看(过去 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 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by