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.
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!