App Designer-Can I use the Report Generator Add-on with App Designer?

조회 수: 3 (최근 30일)
I want to have a button in my app that launches the report generator. Is that possible? How would I do it?
I attached the app I'm working on if that is helpful. And I do have the report generator add-on.

채택된 답변

Thibault MARIN
Thibault MARIN 2018년 3월 29일
Hi, getting the report generator to start with app designer is easy :
function Midterm_reportButtonPushed(app,event)
report MIDTERM_report;
The hard part is to get the report to get values (variables, figures) from the app. I'm still looking for answers to that one. Sorry, I'm not being very helpful, but this it mainly to be able to keep an eye on other answers to your question!
Please let me know if you find a solution.
  댓글 수: 2
Paul Kinnucan
Paul Kinnucan 2018년 3월 29일
편집: Paul Kinnucan 2018년 3월 29일
You can put the report generation code in a callback to a button on your app. For example, you could add a Report button to your app and then generate the report in the callback. If you have R2017b or later, you should use the Report API in the callback. For earlier releases, use the DOM API. Here is a skeleton callback based on the Report API.
function ReportButtonPushed(app, event)
import mlreportgen.report.*
rpt = Report('Midterm Report', 'docx')
add(rpt, TitlePage('Title', 'Midterm Report'));
add(rpt, TableOfContents);
ch = Chapter('Title', 'Surfaces');
walls = {{'Wall 1 Length: ', app.Wall1Length.Value} ...
{'Wall 2 Length: ', app.wall2Length.Value}}'
add(ch, BaseTable('Title', 'Wall Data', 'Content', walls));
add(rpt, ch);
close(rpt);
rptview(rpt.OutputPath);
end
Rachael Cowell
Rachael Cowell 2018년 4월 8일
I figured it would be something simple like that, I've just been having trouble finding things specific to App Designer. Thanks!

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

추가 답변 (3개)

Zacyatta
Zacyatta 2018년 4월 14일
I'm having this similar problem, and I have my report generator code in the callback. It works when I use the app in matlab, BUT the code isn't working when I compile the app into an executable. I've even commented out my code so only one chapter will appear, referenced the data from the GUI using the handles object to the callback.
  댓글 수: 3
YG W
YG W 2024년 1월 22일
I have also encountered this problem. Have you solved it?
Moein Siadaty
Moein Siadaty 2025년 1월 5일
편집: Moein Siadaty 2025년 1월 5일
Dear YG W ;
I have the same problem. the report generation is correctly works on the app designer and do not works on stand alone app. The generated .pdf file size is 0 kB. Do you solve it?

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


Zacyatta
Zacyatta 2018년 4월 14일
https://www.mathworks.com/matlabcentral/answers/393008-how-do-i-add-a-handles-axes-figure-into-a-html-report-programatically

Zacyatta
Zacyatta 2018년 4월 14일
편집: Zacyatta 2018년 4월 14일
I answered you question myself in another thread. Now I'm stuck with an app not working when compiled into an executable.
  댓글 수: 1
Moein Siadaty
Moein Siadaty 2025년 1월 5일
Dear Zacyatta ;
I have the same problem. the report generation is correctly works on the app designer and do not works on stand alone app. Do you solve it?

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by