why nanmean error?

조회 수: 16 (최근 30일)
Lilya
Lilya 2018년 12월 24일
댓글: madhan ravi 2019년 1월 3일
Hi all,
I am trying to average 3d matrix that have nan values, but I am getting the following error:
Error using nanmean
Too many input arguments.
and the resulted matrix when i used mean function it doesn't show any data
any suggestion?
Thanks u
  댓글 수: 1
Guillaume
Guillaume 2018년 12월 24일
any suggestion?
Clearly, you passed too many inputs to nanmean. Crucially you haven't shown us how you call nanmean so it's difficult to say exactly what you do wrong.
Note that since R2014b (I think), there is no need to use nanmean, the regular mean function can ignore nans.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2018년 12월 24일
편집: Star Strider 2018년 12월 24일
You may have your own function or a variable that you named ‘nanmean’.
Run this from a script or your Command Window:
which nanmean -all
If the first result is:
nanmean is a variable.
You have found the problem. The solution is to re-name your function or variable to something that does not overshadow any MATLAB functions, and is meaningful to you.
  댓글 수: 6
Star Strider
Star Strider 2018년 12월 24일
No worries, and no need to apologise. It is a relatively common belief that most of us are MathWorks employees (‘MathWorkers’). Only those with the blue ‘STAFF’ label by their names actually are. The rest of us are just here for the fun of it!
madhan ravi
madhan ravi 2018년 12월 24일
Second Star Strider.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

madhan ravi
madhan ravi 2018년 12월 24일
편집: madhan ravi 2018년 12월 24일
If your using 2018b version just use mean with 'omitnan' as a name pair
doc mean % if and only if your using 2018b to use them with n dimensions
  댓글 수: 2
Lilya
Lilya 2019년 1월 3일
ok.. thanks a lot!
madhan ravi
madhan ravi 2019년 1월 3일
Anytime :) , if you find it helpful make sure to accept the answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by