Avoiding for loop with anova1
6 ビュー (過去 30 日間)
古いコメントを表示
I have 2 large 3D matrices, and I've noticed that passing a DIM argument for the ttest2 function decreases the computational time on my computer substantially as opposed to looping through each index in the first 2 dimensions (near 60-fold for the data I'm working with):
[~,~,~,stats]=ttest2(A,B,[],[],[],3);
vs.
stats=cell(rmax,cmax);
for r=1:rmax
for c=1:cmax
[~,~,~,stats{r,c}]=ttest2(A(r,c,:),B(r,c,:));
end
end
Now I would like to do the same thing, but adding another matrix C and using anova1 instead of ttest2. The documentation for anova1 suggests that it won't accept a similar DIM argument, but I'm wondering if there's a similar way to cut down on time and avoid looping through each element.
Thanks!
Zach
4 件のコメント
Star Strider
2015 年 4 月 5 日
I still have no idea what you’re doing, but if you’re doing clustering, you might want to look through the Statistics Toolbox for cluster algorithms such as clusterdata. There are several others, and several related functions, such as those listed at the end of that webpage.
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Analysis of Variance and Covariance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!