Save as functionality for report generation

5 ビュー (過去 30 日間)
Mihir Tasgaonkar
Mihir Tasgaonkar 2022 年 6 月 28 日
回答済み: Mary Abbott 2022 年 6 月 29 日
I'm trying to add a report generation functionality for my GUI, where the user will be able to run certain tests, and then generate a report with all inputs, outputs and graphs. I want to add a "Save as" feature, where the user will be able to decide what name to save his/her report by. I have previously tried the following code:
import mlreportgen.report.*
import mlreportgen.dom.*
[file,path]=uiputfile('*.pdf','Save As','Test Results');
report=fullfile(path,file);
TestReport = Report(file,'pdf');
TestReport.OutputPath=path;
But while this pops up a "Save as" figure window, it doesn't save the report eventually. Any suggestions?

採用された回答

Mary Abbott
Mary Abbott 2022 年 6 月 29 日
Hello,
The OutputPath property of a report holds the full path to the report file, including the name of the file. The report variable you create in your code should be used to specify the OutputPath of the report:
import mlreportgen.report.*
import mlreportgen.dom.*
[file,path]=uiputfile('*.pdf','Save As','Test Results');
report=fullfile(path,file);
% This constructor sets the OutputPath property to the correct file path
TestReport = Report(report,'pdf');
% Generate report

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by