Report Model Notes
This example shows how to create a report that embeds model notes. The report includes a chapter for each system in the model. Each chapter includes a system snapshot and any notes for that system.
Open a model that has notes.
model = "slreportgendemo_autotrans"; open_system(model);
Import the Report Generator API packages so that you do not have to use long, fully qualified class names.
import mlreportgen.report.* import slreportgen.report.* import slreportgen.finder.*
Create and open a Simulink report object. To create a Microsoft® Word, HTML, or single-file HTML report, change "
pdf" to "
html", or "
rpt = slreportgen.report.Report(model + "_Notes_Report","pdf"); open(rpt);
Add a title page and table of contents.
titlepage = TitlePage("Title",model); add(rpt,titlepage); toc = TableOfContents(); add(rpt,toc);
Report on systems
Find and loop through all of the systems in the model.
finder = DiagramFinder(model); while hasNext(finder) system = next(finder);
Create a new chapter and add the system result, which adds a system snapshot to the report.
ch = Chapter("Title",system.Name); add(ch,system);
Add model notes to the current system. If the current system does not have any notes associated with it, nothing is added.
notes = Notes(system); add(ch,notes);
Add the chapter to the report
Close and view the report.