How do I print results of ANOVA to a title?

12 vues (au cours des 30 derniers jours)
ealicic
ealicic le 22 Jan 2019
I'm trying to figure out how I can print one-way ANOVA results dynamically to the title of my boxplot using the sprintf function. For example, the title would be "F(3, 32) = 0.43, p = 0.733", but I'm just having a hard time figuring out how to take that data from the ANOVA results and get it into my title. I'd also want this code to work for whatever data set I'm using.
Hopefully that makes sense, I'm really new to MATLAB.

Réponses (1)

Jos (10584)
Jos (10584) le 22 Jan 2019
You have to create a string (character array) from the results of the ANOVA. Something like this
[p,TB] = anova1(...)
str = sprintf('F(%d) = %.2f, p = %.3f', TB{2,3}, TB{2,5}, TB{2,6})
title(str)

Community Treasure Hunt

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

Start Hunting!

Translated by