how to save anovan figure as a .fig?

2 views (last 30 days)
i'm using anovan in a loop to generate ANOVA for multiple variables,
and i was not able to save the generated figure as a .fig
i was wondering if there is a way to do so?

Accepted Answer

Star Strider
Star Strider on 1 Dec 2022
It is likely not possible to save the image, however anovan creates a table with the same information if you request it, and it is certainly possible to save that —
y = [52.7 57.5 45.9 44.5 53.0 57.0 45.9 44.0]';
g1 = [1 2 1 2 1 2 1 2];
g2 = {'hi';'hi';'lo';'lo';'hi';'hi';'lo';'lo'};
g3 = {'may';'may';'may';'may';'june';'june';'june';'june'};
[p,Tbl] = anovan(y,{g1,g2,g3}) % Return Table Of Results
p = 3×1
0.4174 0.0028 0.9140
Tbl = 6×7 cell array
{'Source'} {'Sum Sq.' } {'d.f.'} {'Singular?'} {'Mean Sq.'} {'F' } {'Prob>F' } {'X1' } {[ 3.7813]} {[ 1]} {[ 0]} {[ 3.7813]} {[ 0.8160]} {[ 0.4174]} {'X2' } {[199.0013]} {[ 1]} {[ 0]} {[199.0013]} {[ 42.9460]} {[ 0.0028]} {'X3' } {[ 0.0612]} {[ 1]} {[ 0]} {[ 0.0612]} {[ 0.0132]} {[ 0.9140]} {'Error' } {[ 18.5350]} {[ 4]} {[ 0]} {[ 4.6338]} {0×0 double} {0×0 double} {'Total' } {[221.3788]} {[ 7]} {[ 0]} {0×0 double} {0×0 double} {0×0 double}
writecell(Tbl, 'MyAnovanResults.txt') % Write Table Of Results To Text File
Tanovan = readtable('MyAnovanResults.txt', 'VariableNamingRule','preserve') % Read Table Of Results
Tanovan = 5×7 table
Source Sum Sq. d.f. Singular? Mean Sq. F Prob>F _________ _______ ____ _________ ________ ________ _________ {'X1' } 3.7813 1 0 3.7813 0.81602 0.41743 {'X2' } 199 1 0 199 42.946 0.0028037 {'X3' } 0.06125 1 0 0.06125 0.013218 0.91401 {'Error'} 18.535 4 0 4.6338 NaN NaN {'Total'} 221.38 7 0 NaN NaN NaN
The anovan function has other outputs as well that you may want to consider requesting.
.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!