Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

checking conditions on 2 arrays

1 visualizzazione (ultimi 30 giorni)
Yogesh Kumkar
Yogesh Kumkar il 6 Feb 2018
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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?

Risposte (1)

Walter Roberson
Walter Roberson il 6 Feb 2018
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.

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by