Run regressions and output the result as a report using "Report Generator"

조회 수: 1 (최근 30일)
I run regressions such as
fitlm(T.population, T.sales)
I want to output a report that explains
  • these regression equations and comments
  • output of fitlm
I looked at "Matlab Report Generator" https://www.mathworks.com/products/matlab-report-generator.html but I do not see an example that helps me get started. Thank you.

채택된 답변

Raynier Suresh
Raynier Suresh 2021년 1월 21일
편집: Raynier Suresh 2021년 1월 21일
I have written a simple code which will generate a report similar to what you expect. You can customize it based on your needs
import mlreportgen.report.*
import mlreportgen.dom.*
R = Report('Sample','pdf'); % Create a pdf report with name 'Sample'
open(R)
add(R,'MATLAB REPORT FOR LINEAR MODEL') % Add a heading to the report
X = [0 0;0 1;1 0;1 1]; % Data Martix X
Y = [0;1;2;3]; % Responses Y
mdl = fitlm(X,Y) % fit linear regression model
add(R,' ')
add(R,strcat('Linear Regression Model : ',mdl.Formula.LinearPredictor)) % add the formula of model to report
add(R,' ')
add(R,'Estimated Coefficients: ')
add(R,' ')
Tab = Table(mdl.Coefficients) % add the estimated Coefficients
add(R,Tab)
close(R)
You can refer the documentation page for more information : https://www.mathworks.com/help/rptgen/
  댓글 수: 1
alpedhuez
alpedhuez 2021년 1월 23일
편집: alpedhuez 2021년 1월 23일
Let me work on it. It will be just simpler if you create an option of disabling auto-scrolling in Livescript
https://www.mathworks.com/matlabcentral/answers/621643-auto-scrolling-in-livescript-output

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by