Awkward copy/paste question

조회 수: 1 (최근 30일)
Grant
Grant 2012년 1월 10일
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개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by