From: slang092 Lang on
I am having problems using the ttest2 function in matlab7.8.0 R2009a
even when i enter in 2 sets of random data (ie. a=[2;4;5;6;4;3;5], b=[2;4;8;6;5;4;2]
then ttest2 (a,b)
I get this error. I do not get this error in an earlier version of matlab, with the same data.

?? Error using ==> size
Dimension argument must be a positive integer scalar within indexing range.

Error in ==> nanmean at 43
count = size(x,dim) - sum(nans,dim);

Error in ==> nanvar at 54
avg = nanmean(x,dim);

Error in ==> ttest2 at 136
s2x = nanvar(x,[],dim);
From: Wayne King on
"slang092 Lang" <sl_00_sl(a)hotmail.com> wrote in message <i1kt3k$f6p$1(a)fred.mathworks.com>...
> I am having problems using the ttest2 function in matlab7.8.0 R2009a
> even when i enter in 2 sets of random data (ie. a=[2;4;5;6;4;3;5], b=[2;4;8;6;5;4;2]
> then ttest2 (a,b)
> I get this error. I do not get this error in an earlier version of matlab, with the same data.
>
> ?? Error using ==> size
> Dimension argument must be a positive integer scalar within indexing range.
>
> Error in ==> nanmean at 43
> count = size(x,dim) - sum(nans,dim);
>
> Error in ==> nanvar at 54
> avg = nanmean(x,dim);
>
> Error in ==> ttest2 at 136
> s2x = nanvar(x,[],dim);

Hi, are you sure that you don't have another function called nanmean.m in your MATLAB path that precedes the toolbox\stats\stats\nanmean.m function.

If you enter

which nanmean

what is returned?

Wayne
From: slang092 Lang on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <i1l08n$c82$1(a)fred.mathworks.com>...
> "slang092 Lang" <sl_00_sl(a)hotmail.com> wrote in message <i1kt3k$f6p$1(a)fred.mathworks.com>...
> > I am having problems using the ttest2 function in matlab7.8.0 R2009a
> > even when i enter in 2 sets of random data (ie. a=[2;4;5;6;4;3;5], b=[2;4;8;6;5;4;2]
> > then ttest2 (a,b)
> > I get this error. I do not get this error in an earlier version of matlab, with the same data.
> >
> > ?? Error using ==> size
> > Dimension argument must be a positive integer scalar within indexing range.
> >
> > Error in ==> nanmean at 43
> > count = size(x,dim) - sum(nans,dim);
> >
> > Error in ==> nanvar at 54
> > avg = nanmean(x,dim);
> >
> > Error in ==> ttest2 at 136
> > s2x = nanvar(x,[],dim);
>
> Hi, are you sure that you don't have another function called nanmean.m in your MATLAB path that precedes the toolbox\stats\stats\nanmean.m function.
>
> If you enter
>
> which nanmean
>
> what is returned?
>
> Wayne

problem solved.
Thank you