how to i check if matrix cotaining logical 1

I got B and i want to check if B cotains at least one '1' display super
if all zeros display not good
How do i do it
A = [1 0 0];
B = logical(A)
if B == 1;
disp('super')
else
disp('not good')
end

 Accepted Answer

KSSV
KSSV on 3 Dec 2020
Edited: KSSV on 3 Dec 2020
A = [1 0 0];
B = logical(A) ;
if any(B);
disp('super')
else
disp('not good')
end

1 Comment

Thanks dudu just finist my dog detection software whoooo

Sign in to comment.

More Answers (1)

Tags

Asked:

on 3 Dec 2020

Commented:

on 3 Dec 2020

Community Treasure Hunt

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

Start Hunting!