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 日

0 投票

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 件のコメント

Image Analyst
Image Analyst 2018 年 12 月 24 日
Also, posting the FULL error message - ALL the red text, not a snippet from it - would help.
I know the full error message is not
Error using nanmean
Too many input arguments.
UNLESS the error was thrown from inside the nanmean function itself instead of by MATLAB, because MATLAB error messages also include the line number and the actual line of code that threw the error.
Lilya
Lilya 2018 年 12 月 24 日
編集済み: Lilya 2018 年 12 月 24 日
Thank you @Guillaume , @ madhan ravi , and @ Star Strider it is exactly as what you said. there is another function have the same name. Thanks once again amazing people :)
Star Strider
Star Strider 2018 年 12 月 24 日
As always, my pleasure.
Also, we are not ‘mathworks people’ (although MathWorkers do appear here, with the ‘STAFF’ label by their names). We are unpaid volunteers who help to solve problems because we enjoy doing it.
Lilya
Lilya 2018 年 12 月 24 日
Edited.. sorry for that.
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 日

1 投票

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.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

質問済み:

2018 年 12 月 24 日

コメント済み:

2019 年 1 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by