Awkward copy/paste question

1 次查看(过去 30 天)
I've a very frustrating problem:
I have some very large matrixes like this (69 x 2311):
nan nan 1 nan nan 1 0 nan 0 0 0 1 nan nan 0 nan
and others like this:
99 99 64 99 99 32 0 99 0 0 0 36 99 99 0 99
They are of the same data, in one values are 1 or 0 and in the other 0-100. In one, the values i'm not concerned with are nans, but the other they are 99 and I need to change them into nans, but I can't change them all like I did with the other, because the values I am_ concerned with also includes some 99s (since they run 0-100). It's way too big to manually replace. I was wondering if there's way I can overlay the Nans from one onto the other - the two matrixes correspond exactly. Is there a way I can copy and paste just the NaNs without overlaying (and therefore losing) all the data?
Thank you

采纳的回答

Andrew Newell
Andrew Newell 2012-1-10
If your two vectors are v1 and v2, use:
v2(isnan(v1)) = nan;
  1 个评论
Grant
Grant 2012-1-10
Thank you very much! Perfect, I feared I would have to spend days doing it manually.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by