MATLAB: Is there a way to “handle” the ANOVA boxplot

anovabox plotboxplotfigureMATLAB

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 !

Best Answer

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.