0

How can I replace all NaN in an array in matlab? I want to replace all NaN value with some infinite value. My code is shown below:

   Z=
          NaN
           NaN
      23.0490
        2.8444
          -Inf
       NaN
       NaN
       19.0081
        5.1412
       39.4275
    6.3174
      -Inf
       NaN
       NaN
   19.0081
    5.1412
   28.2539
    9.3265
   37.7239
   11.9736
  -16.4239
    9.3265
   -8.2900
  -25.6488
       NaN
       NaN

1 Answer 1

3

Have you tried:

Z(isnan(Z)) = inf
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.