ttest2 not working in Matlab 2019a

3 ビュー (過去 30 日間)
Ross Nichols
Ross Nichols 2019 年 8 月 25 日
編集済み: Walter Roberson 2019 年 8 月 25 日
load examgrades
x = grades(:,1);
y = grades(:,2);
[h,p,ci,stats] = ttest2(x,y)
When I run this code in Matlab 2019a, found on the ttest2 documentation page, I get the following error:
Error using size
Dimension argument must be a positive integer scalar within indexing range.
Error in nanmean (line 43)
count = size(x,dim) - sum(nans,dim);
Error in nanvar (line 54)
avg = nanmean(x,dim);
Error in ttest2 (line 173)
s2x = nanvar(x,[],dim);
Anyone understand what is going on here?
Thank you very much.
Ross

採用された回答

Walter Roberson
Walter Roberson 2019 年 8 月 25 日
編集済み: Walter Roberson 2019 年 8 月 25 日
You have your own (or some third-party) nanmean.m file .
Notice the error is on line 43 of nanmean. The Mathworks provided nanmean for R2019a is only 22 lines long. Furthermore, the error is shown as being on line 54 of nanvar, but the Mathworks provided nanvar for R2019a has only 42 lines.
I looked back to R2010* and confirmed that the official Mathworks version of nanmean has never had as many as 43 lines.
  1 件のコメント
Ross Nichols
Ross Nichols 2019 年 8 月 25 日
Ahhhhhh
This absolutely would explain it. I'll hunt it down and remove it from my path. Thank you so much :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by