Re: How to change a value into NaN



On Jun 29, 1:58 pm, Scott <n...@xxxxxxxx> wrote:
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- Hide quoted text -

- Show quoted text -

Yes, thanks Scott. Have a good weekend everyone, wherever you are.

.



Relevant Pages

  • Re: How to change a value into NaN
    ... On Jun 29, 1:21 pm, Peter Boettcher ... val= NaN; ... is a one-row matrix rather than the 88x118 matrix. ... If A is your numeric matrix, ...
    (comp.soft-sys.matlab)
  • Re: Join two vectors
    ... EMD wrote: ... Thanks Scott. ... 732961 NaN ...
    (comp.soft-sys.matlab)
  • Re: Join two vectors
    ... Thanks Scott. ... 732961 NaN ... I have tried various combinations of intersect, setxor, and setdiff ...
    (comp.soft-sys.matlab)