Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I am using this statement in Matlab in my computer then its giving error as follow:



??? Error using ==> nanmean
Too many input arguments.

Error in ==> ttest at 104
xmean = nanmean(x,dim);

However if I use the same statement in Matlab in another computer, then its working fine and giving results. Do you know what could be the problem? I am posting this question here suspecting it to be some software problem with Matlab. Correct me if I am wrong.

share|improve this question
up vote 2 down vote accepted

If the same code works on one and not on the other, then my guess is the version of matlab your using on one is pickier than on another. Have you checked that they are the same version of matlab on both machines? My guess is they are different.

Regardless, some thing to try:

It looks to me as if one matlab version is treating the output as randn as a series of arguments passed to ttest, not as a vector containing your random sample.

Also, just to help debug, I would use:


Have you tried x=randn([100,1])? Although I would not expect this to matter...

Is it possible that sometimes 0.1 doesn't make sense as a mean for the set? Looking at x might help. My guess is this will work on both, assuming you want the mean to be = 0.1:

% Generate values from a normal distribution with mean 0.1 
% and standard deviation 0.5
x=0.1 + 0.5*randn(100,1)
share|improve this answer
Problem solved. It was actually a path related problem. The nanmean.m file was is mGstat toolbox instead of being in STATS toolbox, where ttest.m is placed. Thank you! – Pupil Sep 28 '10 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .