Could anyone tell me why NaN is being present instead of numbers.

2 vues (au cours des 30 derniers jours)
Prabha Kumaresan
Prabha Kumaresan le 5 Fév 2018
Commenté : Jan le 5 Fév 2018
Could anyone tell me why NaN is being present instead of numbers.

Réponse acceptée

Birdman
Birdman le 5 Fév 2018
Modifié(e) : Birdman le 5 Fév 2018
  3 commentaires
Birdman
Birdman le 5 Fév 2018
Modifié(e) : Birdman le 5 Fév 2018
I can if you share your code. You may use isnan.
Jan
Jan le 5 Fév 2018
@Prabha: To avoid the creation of NaN value, you have to avoid to perform calculations, which have NaN as result. There is no general way to "avoid" them, because they are the mathematically correct result for certain operations.
You get e.g. NaN for the numerical value of an imported Excel file, if the corresponding cell contains a string. Or you get NaN, if you divide by 0. If you need a method to catch this, post the relevant part of your code, as usual.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by