Matlab Report generator help

조회 수: 5 (최근 30일)
Caleb Darr
Caleb Darr 2020년 8월 6일
댓글: Caleb Darr 2020년 8월 7일
Using Matlab add-on "Report Generator" I am trying to create a matlab script where I can import my results from a lab and generate a report with the given figures, tables, and graphs. I am not having difficulty importing my data into the file, but I have having trouble formatting my lab report. For instance when creating a title page I am able to add the title, author, publisher, and publication date with the built in functions; however, I am have difficulty adding more to this page for instance additional contributors, course number, instructor, etc. How can I add these text items and then format the font, size, color, text positon on page (centered, right align, or left align).
Additionally how to I add headers and footers. In general I feel like I am lacking the knowledge of how to use Report Generator and if available general library of code could help in developing my script.
% Import report API classes
import mlreportgen.report.*
import mlreportgen.dom.*
% Add report container
doctype = 'docx'; % docx, pdf, html
reportname = 'LabReport'
R = Report(reportname, doctype);
% Title Page
% Enter required information into the title page
publisher = 'Name';
title = 'Title of Lab';
author = 'Written by: Name';
contr1 = 'First Last, email';
contr2 = 'First Last, email';
contr3 = 'First Last, email';
contr4 = 'First Last, email';
date = 'DOW #:## pm -- Date';
course = ' ###: Name';
inst = 'Dr. ****, email (###)###-####';
tA = 'Name, email';
tp = TitlePage;
tp.Title = title;
tp.Author = author;
tp.Publisher = publisher;
tp.PubDate = date;
add(R, tp);

답변 (1개)

Rahul Singhal
Rahul Singhal 2020년 8월 6일
Hi Caleb,
To add more information to the title page, you will have to customize the TitlePage reporter class. Use mlreportgen.report.TitlePage.customizeReporter method to create a custom title page class. This will also copy all the default title page templates. Then add properties in this custom class for each additional infomation you wish to add. You will also have to customize the templates to add a hole corresponding to each newly added property.
The below link describes, with sample code, on how to customize the Chapter reporter class to add more information as I mentioned above. In the same way you can customize the TitlePage reporter class.
The above link also has information on customizing the chapter page headers.
Thanks,
Rahul
  댓글 수: 1
Caleb Darr
Caleb Darr 2020년 8월 7일
Thank you very much Rahul for the help, I am working on learning how to utilize your suggestions
Best,
Caleb

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

Community Treasure Hunt

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

Start Hunting!

Translated by