Is there a way to "handle" the ANOVA boxplot ?

5 visualizaciones (últimos 30 días)
MattH
MattH el 11 de Mayo de 2018
Comentada: Ameer Hamza el 21 de Mayo de 2018
Hi all, I am doing several ANOVAs in a row and I would like to save each boxplot (I mean automatically, I know how to do it manually). Unfortunately I cannot create a figure handler (such as h=plot(...)) nor rename the box plot using "figure" (commented below). The only ugly workaround I have found so far is by using findobj(allchild(0), 'flat', 'Type', 'figure') after each ANOVA...
Anyone has a better idea ?
%figure('Name','LeftStepScores','NumberTitle','off')
[lSp,lStbl,lSstats] = anova1(leftA);
xticklabels(leftXlabels);
title('Left step scores')
Cheers !
  2 comentarios
MattH
MattH el 13 de Mayo de 2018
anyone ?
MattH
MattH el 20 de Mayo de 2018
guess not...

Iniciar sesión para comentar.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 20 de Mayo de 2018
Why don't you just use figure(). anova1() produce 2 figures, you can get their handles using
hTable = figure(1);
hBoxPlot = figure(2);
Similarly for other iteration use
hTable = figure(3);
hBoxPlot = figure(4);
You can also check if you have chosen the correct figure by checking the tag property of figure handle.
  2 comentarios
MattH
MattH el 21 de Mayo de 2018
Thank you Ameer, it works. I didn't know figure() could be called after the figure has been created. Thanks a lot !
Ameer Hamza
Ameer Hamza el 21 de Mayo de 2018
You ae welcome.

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 20 de Mayo de 2018
You have mentioned the best solution already.
FigList = allchild(groot);
[lSp, lStbl, lSstats] = anova1(leftA);
FigHandle = setdiff(allchild(groot), FigList);
This is not "ugly", but works reliably.
I do not have the toolbox required to run annova1, so I cannot test if the created figure has a hidden handle. But when
xticklabels(leftXlabels);
title('Left step scores')
works correctly, the handle should be not hidden. Then this will work also:
FigHandle = gcf;
  1 comentario
MattH
MattH el 21 de Mayo de 2018
Thanks ! gcf won't work here because anova1 generates two figures simultaneously but it's a cool trick !

Iniciar sesión para comentar.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by