Troubleshooting an error in var when running ttest

2 views (last 30 days)
I'm trying to do a 1-sample t-test on a vector of data that has 116 elements in it, and I keep getting an error.
To troubleshoot, I tried a random vector, x. Here is the output:
x=randn(100,1)
[h,p,ci]=ttest(x,0.1)
Error using var
Too many input arguments.
Error in nanvar (line 42)
y = var(varargin{:},'omitnan');
Error in nanstd (line 35)
y = sqrt(nanvar(varargin{:}));
Error in ttest (line 136)
sdpop = nanstd(x,[],dim);
I tried this on a 2019a install on another computer and got the same error.
I've never seen this type of error, but it doesn't appear to be t-test. What would var be looking for in this instance?
  9 Comments
Adam Danz
Adam Danz on 22 Jun 2020
If your instructor is the author of the toolbox, it may be helpful to let him/her know about this so it can be avoided in the future. var() is a very common function so I can imagine that you're not the first one to have this problem with that toolbox.
Michael Wright
Michael Wright on 22 Jun 2020
That's a good point; I'm not sure the person who made it even supports it anymore (he worked in a colleague's lab over a decade ago), but I think I can track him down!
Cheers

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!