I have a dataset and I want the mean value of the numbers. There are a lot of NaN-values in there and I want to ignore those (the code
mean(data)
now gives 'NaN' as answer) How do I do this?

 Akzeptierte Antwort

Mischa Kim
Mischa Kim am 9 Okt. 2014

1 Stimme

Evelyn, use
mean(data(~isnan(data)))

Weitere Antworten (1)

Thorsten
Thorsten am 9 Okt. 2014

1 Stimme

Use nanmean

1 Kommentar

Mischa Kim
Mischa Kim am 9 Okt. 2014
That's another option. You need to have access to the Statistics Toolbox though.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Type Identification finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 9 Okt. 2014

Kommentiert:

am 9 Okt. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by