You may have your own function or a variable that you named ‘nanmean’.
Run this from a script or your Command Window:
If the first result is:
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.