MATLAB: How do you print output of fitlme to a text file

fitlme print output to text fileprint output of fitlme to a text file

I have run a mixed linear model using fitlme. I want to write all of the output printed in the workspace when typing lme to a text file.
How can I do this?
Thanks
Peter

Best Answer

Use the diary command. Example:
diary('lmeDetails.txt')
lme
diary off