Removing elements in one matrix with same position as those in another matrix in matlab

2 visualizaciones (últimos 30 días)
I have two large matrices, matrix Z and matrix H, both 121x962. In matrix Z I removed values below a desired threshold and left NaN in place of those elements, so the size of the matrix did not change. In matrix H, I want to remove the values that are in the corresponding position as those labelled NaN in matrix Z.
For example, in matrix Z I have elements [1,2], [50,7], [40,32], [113,6] etc. labelled as NaN. I want to remove these same elements ([1,2], [50,7], [40,32], [113,6] etc.) from matrix H. Is there a way to specify that I want to remove all the elements labelled NaN in Z from matrix H without having to provide the exact coordinates I want to remove.

Respuesta aceptada

madhan ravi
madhan ravi el 18 de Sept. de 2020
H(isnan(Z)) = nan

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by