Print statistics model output that is shown in command window

1 view (last 30 days)
Hi all, (this question probably applies to all statistics models):
I have built a mixed effects model using fitlme() and when you don't use the semicolon, for example
lm=fitlme(data, 'y ~ x1 + x2*x3 + (1|x4)')
the model properties and diagnostics gets printed in the command window, including the model information (number of observations, numbers of coefficients etc), the formula, the model fit statistics, the fixed and random effects coefficients/covariance parameters with 95% CIs, p-values, etc.
Is there a quick/elegant way to write all of this output into an external file (preferably xls) without going into the lm object variable, getting each of the properties and printing it 'manually' by writing my own lines using xlswrite()? I also seem to not be able to find some of the properties that get shown in the command window within the lm object, so I was wondering specifically if there was an automatic way of writing the full output into some file.
Thanks!
  1 Comment
Daemonic
Daemonic on 3 Aug 2021
I'm sure you've gotten your answer by now. However, just in case, you can print the output of the model into a text file with the following:
diary('filename.txt')
lm
diary off
You can also place into a csv or xls however the tab delimiter does not carry over unfortunately.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!