programmatically define save location of reports generated through mlreportgen.dom

12 views (last 30 days)
i'm figuring out how to programmatically generate reports with matlab, I've got a finished product for one of the experiments I run. I am using mlreportgen.dom
The current save location is at
C:/Users/AppData/Local/Temp/mlreportgen
how can I programmatically define that location in matlab? I've changed the output path as shown in here
https://www.mathworks.com/help/rptgen/ug/mlreportgen.dom.document-class.html
but that only changes were the .htmx file saves, which is no good.

Answers (1)

Wilson A N
Wilson A N on 22 Jun 2018
Hi Mattj,
I was able to use the 'OutputPath' parameter given in the mlreportgen.dom for saving the output files in .pdf, .html, .docx into the specified outpath path. I modified the same example given in the documentation page you had listed. The modified code is given below:
import mlreportgen.dom.*;
d = Document('mydoc','pdf');
d.OutputPath = 'E:\Workspace\Newpath.pdf'
append(d,'Hello World');
close(d);
rptview(d.OutputPath);
Can you provide a sample code so that I can check it out at my end.
  1 Comment
Gwendolyn Williams
Gwendolyn Williams on 6 Mar 2024
I realize it's been awhile since anyone touched this thread, but just in case anyone else needed to know:
Yes, using d.OutputPath works to set the output path for the report.
I used a report (rpt = Report('reportname','pdf'), and it worked beautifully.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!