Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

checking conditions on 2 arrays

3 visualizaciones (últimos 30 días)
Yogesh Kumkar
Yogesh Kumkar el 6 de Feb. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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?

Respuestas (1)

Walter Roberson
Walter Roberson el 6 de Feb. de 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.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by