Renaming Fit rsquare value

1 view (last 30 days)
I have made a fit for a set of data. It returns an rsquare value, which I have to rename to R1.
%This is the code for the fit
%Below is the output for gof. I need to rename rsquare to R1.
gof =
struct with fields:
sse: 2.1928e+03
rsquare: 0.0121
dfe: 8
adjrsquare: -0.1114
rmse: 16.5561

Accepted Answer

Scott MacKenzie
Scott MacKenzie on 26 Jun 2021
R1 = gof.rsquare
Scott MacKenzie
Scott MacKenzie on 26 Jun 2021
I notice that you are not renaming the gof variable returned in each call to fit. So, after the second call, you no longer have gof from the first call. That's fine, but if you want to have all three R-squared values after the three calls to fit, you need to save them in some way. Here's one approach:
R1 = gof.rsquare; % save 1st R-squared value
%% Second order poly
R2 = gof.square; % save 2nd R-squared value
%% Third order poly
R3 = gof.rsquare; % save 3rd R-squared value

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!