Awkward copy/paste question

1 visualizzazione (ultimi 30 giorni)
Grant
Grant il 10 Gen 2012
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

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by