Re: How to change a value into NaN



J.Meyer wrote:


On Jun 29, 1:21 pm, Peter Boettcher <boettc...@xxxxxxxxxx>
wrote:
"J.Meyer" <j.meye...@xxxxxxxxx> writes:
Possibly a very basic question, but:

Is there a way to change a value into NaN? If so, how?

As always, thank you in advance for any ideas.

I'm not sure which of the following you mean:

val = NaN;
val(3,7) = NaN;
data(data>42) = NaN;

-Peter

I have a matrix of values and I would like to replace the values
that
are "0" with "NaN". I have tried the "strrep" approach and the
result
is a one-row matrix rather than the 88x118 matrix.



If A is your numeric matrix, try A(A==0)=NaN.

Scott
.