Anova 1 results into a matrix

1 次查看(过去 30 天)
Hi,
I have a code that loops and returns with their respective Anova 1 analysis. How may I write for a code that automaticlly inputs the results into one matrix?
Thanks!

采纳的回答

Michal
Michal 2019-10-7
Hi,
it depends on what results you would like to get.
You can get the full ANOVA table from anova1 as a cell array.
[~,table] = anova1(y)
Then you can simply store each ANOVA table in a cell array.
for i = 1:number_of_loops % number_of_loops should be equal to how many loops you want to run
[~,table] = anova1(y);
all_results{i} = table;
end
If you would like to get just one result from the ANOVA table you can store it in a matrix in a similar way to the above. Let's say you are interested in the F statistic:
for i = 1:number_of_loops % number_of_loops should be equal to how many loops you want to run
[~,table] = anova1(y);
F_statistic(i) = table{2,5}; % make sure you check that the F statistic of your ANOVA can be found at those indices - (2,5)
end
You can easily work out indices of any of the results by looking at the ANOVA table.
Hope this helps.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 ANOVA 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by