Anova 1 results into a matrix

2 visualizaciones (últimos 30 días)
Cside
Cside el 7 de Oct. de 2019
Respondida: Michal el 7 de Oct. de 2019
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!

Respuesta aceptada

Michal
Michal el 7 de Oct. de 2019
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.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by