필터 지우기
필터 지우기

Getting a mean of only the numbers

조회 수: 3 (최근 30일)
Evelyn
Evelyn 2014년 10월 9일
댓글: Evelyn 2014년 10월 9일
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에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by