What should I do for NaN values?
Mostrar comentarios más antiguos
I have an 1x507 array with NaN values and I am using this array for another calculation. That's why I think these are effecting my calculation. What should I do about them? Should they stay as they are or I should do something?
3 comentarios
C.J. Harris
el 13 de Mzo. de 2018
Without know what calculation you are doing, only you can answer that. If the calculation is "How many NaN values are there in a 1x507 array?", then keep them, if you are doing some numeric calculation then obviously you can't use the NaN values.
But also, you can't just delete them without understanding why they are there in the first place - why does your source data have NaN values?
Sukru Yavuz
el 13 de Mzo. de 2018
Editada: Sukru Yavuz
el 13 de Mzo. de 2018
Stephen23
el 13 de Mzo. de 2018
"What should I do about them? Should they stay as they are or I should do something?"
Why do you assume that you have to "do something" about them? NaN values are there for a reason, and it is usually a bad strategy to turn NaN values into some fake data values (e.g. 0): that would probably distort your calculations even more.
Respuestas (0)
Categorías
Más información sobre NaNs en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!