how to delete NaN from a column of data
Afficher commentaires plus anciens
I have a column of numbers that i called in from excel but some of my data comes up as NaN, which is fine but i need to do calculations on this data and matlab cant do calculations on NaN how can i get rid of the NaN from my data?
example
data=
45
23
NaN
78
mean(data) = NaN
Réponse acceptée
Plus de réponses (1)
James Tursa
le 8 Mai 2012
For your particular example:
mean(data(~isnan(data)))
For general nan handling, you might take a look at the FEX submissions such as this one:
Catégories
En savoir plus sur Language Fundamentals 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!