How can I generate a Simulink report that includes only hierarchies containing "Notes"?

I want to use Simulink Report Generator to create a report that only includes those model or subsystem hierarchies where "Simulink Notes" are defined. How can I do this?

 Accepted Answer

You can achieve this by combining the "slreportgen.utils.hasUniqueModelNotes" with the "slreportgen.report.Notes" class.
Please refer to the sample code below for guidance.
import mlreportgen.report.*
import mlreportgen.dom.*
import slreportgen.report.*
import slreportgen.finder.*
import slreportgen.utils.*
model = "myModel";
load_system(model);
rpt = slreportgen.report.Report(model + "_NotesWithSnapshot", "pdf");
open(rpt);
ch = Chapter("Title", "Notes with Diagram Snapshot");
finder = DiagramFinder(model);
while hasNext(finder)
system = next(finder);
if hasUniqueModelNotes(system)
sec = Section("Title", system.Path);
diag = Diagram(system);
diag.Snapshot.Caption = "Diagram: " + system.Path;
add(sec, diag);
add(sec, Notes(system));
add(ch, sec);
end
end
add(rpt, ch);
close(rpt);
rptview(rpt);

More Answers (0)

Products

Release

R2025a

Community Treasure Hunt

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

Start Hunting!