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