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

2 次查看(过去 30 天)
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.

采纳的回答

madhan ravi
madhan ravi 2020-9-18
H(isnan(Z)) = nan

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by