Main Content

Generate Reports Associated with Models

You can associate a report with your model. By associating a report with a model, you can use a script to generate the report without specifying the name of the report. You can change the association without modifying the script.

Associating a report with a model sets the model parameter ReportName to the name of the report. Each model can have only one report associated with it. You can associate the same report with more than one model.

  1. Open the model you want to associate with a report.

  2. In the Report Explorer, from the hierarchy view, select Report Generator. The library pane lists your reports.

  3. Select the report you want to associate with your model.

  4. In the properties pane, under Simulink, click Associate report with Simulink system. The report and model names are part of the button label.

    Properties pane, focused on Simulink with a button beneath that reads Associate report "simulink_tutorial.rpt" with Simulink system "myModel"

  5. Save the model.

  6. Create a script to generate the report using report. Make sure the model and report template are on the MATLAB® path when you run the script.

    load_system('myModel')
    report(get_param('myModel','ReportName'))
    bdclose('myModel')
    

You can clear the association clicking Un-associate Simulink system.

See Also

Related Topics