필터 지우기
필터 지우기

how to i check if matrix cotaining logical 1

조회 수: 4 (최근 30일)
Kamil Kacer
Kamil Kacer 2020년 12월 3일
댓글: Kamil Kacer 2020년 12월 3일
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

채택된 답변

KSSV
KSSV 2020년 12월 3일
편집: KSSV 2020년 12월 3일
A = [1 0 0];
B = logical(A) ;
if any(B);
disp('super')
else
disp('not good')
end
  댓글 수: 1
Kamil Kacer
Kamil Kacer 2020년 12월 3일
Thanks dudu just finist my dog detection software whoooo

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Paul Hoffrichter
Paul Hoffrichter 2020년 12월 3일
One simple way:
if sum(B) > 0

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by