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

2 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

madhan ravi
madhan ravi am 18 Sep. 2020
H(isnan(Z)) = nan

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by