"Nan" values appear when I run the program. How can I remove them?
Afficher commentaires plus anciens
I have added photos for you to understand the problem:

8 commentaires
Adam
le 14 Août 2017
If you added words too to help us understand the problem that would be even better!
Muhendisleksi
le 14 Août 2017
KSSV
le 14 Août 2017
Getting NaN is easy....divide zero with zero....
Adam
le 14 Août 2017
If it is a cell array (which I assume it must be) then you can replace the NaNs with empty elements [] instead, though whether that is any better or just replacing one thing with another equally unhelpful one I don't know. You cannot simply remove all NaNs though and retain the 2d structure of the data. There has to be 'something' in each cell location, you can't just have a 2d array in which some cells contain 'nothingness'
Jan
le 14 Août 2017
The question is not clear. To explain or fix, what your code does, we have to see the relevant part of the code. If the NaNs should be replaced, we have to know the data type of the shown matrix and the value you want to get instead.
Please, Muhendisleksi, do not let us guess the details.
Muhendisleksi
le 15 Août 2017
What do you mean by 'destroy'? Like I said, data has a structure. Your data is in a 2d structure. If you simply remove all the NaNs it will collapse to 1d and lose all its structure. Youre data appears to be ~90% NaNs though which is a little suspicious!
John D'Errico
le 15 Août 2017
NaNs are the result of an indeterminate operation. So you did something where the computer did not have a valid result to place there.
Essentially, it is best if you show how the NaNs were created. Then you can "remove" them by not creating them in the first place.
Réponses (0)
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!