Info

この質問は閉じられています。 編集または回答するには再度開いてください。

checking conditions on 2 arrays

4 ビュー (過去 30 日間)
Yogesh Kumkar
Yogesh Kumkar 2018 年 2 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have 2d array X of size (750, 450) and another array Y of size(750, 450).
I want to check where there is 0 in X, if there is also 0 in Y.
any one liners?

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 2 月 6 日
mask = ~X & ~Y;
this will be true only in places where X and Y are both exactly 0.
You might prefer to code
mask = (X == 0) & (Y == 0);
and indeed you need that if your arrays might have nan in them as the ~ operator does not work on nan.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by