Getting a mean of only the numbers

4 次查看(过去 30 天)
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?

采纳的回答

Mischa Kim
Mischa Kim 2014-10-9
Evelyn, use
mean(data(~isnan(data)))

更多回答(1 个)

Thorsten
Thorsten 2014-10-9
Use nanmean
  1 个评论
Mischa Kim
Mischa Kim 2014-10-9
That's another option. You need to have access to the Statistics Toolbox though.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Hypothesis Tests 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by