Why is is matlab telling me it's a nan while it's a number????
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matlab keeps telling me nan while i have non 0/0 or something like that in my matrix, does anyone know?
1 commentaire
Stephen23
le 3 Fév 2018
@Nassib Aliouane: please show us the relevant code, values, and/or methods that you are using to check the values. There are many possible ways that data can be encoded and many possible ways that NaNs can occur: so far you have told us nothing at all that would allow us to actually understand what is happening.
Réponses (1)
Steven Lord
le 3 Fév 2018
0/0 is probably the most common way to generate a NaN, but it is not the only way. The Wikipedia entry for NaN lists three categories of operations that can generate a NaN, although some of the operations in the third category don't generate NaN in MATLAB since we can create and store complex numbers. Other common operations that can generate NaN are Inf-Inf or 0*Inf.
If you want to determine where the NaN is being generated and why, set an error breakpoint to stop on Inf or NaN and examine the values of the variables used on that line.
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!