フィルターのクリア

how to i check if matrix cotaining logical 1

3 ビュー (過去 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 Center および File ExchangeSimulation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by