| Contents | Index |
| On this page… |
|---|
Set Report Name, Location, and Format |
The Simulink Report Generator software creates documentation from your model in multiple formats, including HTML, PDF, RTF, Microsoft Word, and XML. This example shows one way to document a code generation project in Microsoft Word. The generated report includes:
System snapshots (model and subsystem diagrams)
Block execution order list
Simulink Coder and model version information for generated code
List of generated files
Optimization configuration parameter settings
Simulink Coder target selection and build process configuration parameter settings
Subsystem map
File name, path, and generated code listings for the source code
To adjust Simulink Report Generator settings to include custom code and then generate a report for a model, complete the following tasks:
For more information on generating other reports, see the Simulink Report Generator User Guide.
Before you use the Report Generator to document your project, you must generate code for the model.
In the MATLAB Current Folder browser, navigate to a folder where you have write access.
Create a working folder from the MATLAB command line by typing:
mkdir report_ex
Make report_ex your working folder:
cd report_ex
Open the rtwdemo_f14 model by clicking the following model name below or by entering the model name on the MATLAB command line:
rtwdemo_f14
In the model window, choose File > Save As, navigate to the working folder, report_ex, and save a copy of the rtwdemo_f14 model as myf14.mdl.
Open Model Explorer by selecting Model Explorer from the model View menu.
In the Model Hierarchy pane, click the + sign preceding the model name to reveal its components.
In the left pane, click Configuration (Active).
In the center pane, click Code Generation.
In the Code Generation pane, select the Report tab. Clear the Create code generation report and Open report automatically check boxes.
Select the General tab. Select Generate code only, and click Apply.
Click Generate code. The Simulink Coder build process generates code for the model.
After you generate the code, open the Report Generator.
In the model window, select Tools > Report Generator.
In the Report Explorer window, in the options pane (center), find the folder rtw (\toolbox\rtw) and the setup file that it contains, codegen.rpt.

Double-click codegen.rpt or
select it and click the Open report button
. The Report Explorer
displays the structure of the setup file in the outline pane (left).

Before generating a report, you can specify report output options, such as the folder, file name, and format. For example, to generate a Microsoft Word report named MyCGModelReport.rtf:
In the properties pane, under Report Options, review the options listed.

Leave the Directory field set to Present working directory.
For Filename, select Custom: and replace index with the name MyModelCGReport.
For File format, specify Rich Text Format and replace Standard Print with Numbered Chapters & Sections.
Specify the models and subsystems that you want to include in the generated report by setting options in the Model Loop component.
In the outline pane (left), select Model Loop. Report Generator displays Model Loop component options in the properties pane.
If not already selected, select Current block diagram for the Model name option.
In the outline pane, click Report - codegen.rpt*.
After specifying the models and subsystems to include in the report, you can customize the sections included in the report.
In the outline pane (left), expand the node Chapter - Generated Code. By default, the report includes two sections, each containing one of two report components.
Expand the node Section 1 — Code Generation Summary. The Code Generation Summary component displays.
Select Code Generation Summary. Options for the component are displayed in the properties pane.
Click Help to review the report customizations that you can make with the Code Generation Summary component. For this example, do not customize the component.
Return focus to the Report Explorer window and expand the node Section 1 — Generated Code Listing. The Import Generated Code component displays.
Select Import Generated Code. Options for the component are displayed in the properties pane.
Click Help to review the report customizations that you can make with the Import Generated Code component.
Return focus to the Report Explorer window.
After you adjust the report options, from the Report Explorer window, generate the report by clicking File > Report. A Message List dialog box opens, which displays messages that you can monitor as the report is generated. Model snapshots also appear during report generation. The Message List dialog box might be hidden behind other dialog boxes.
For alternative ways of generating reports, see Generate a Report in the Simulink Report Generator documentation.
![]() | Package and Share the HTML Code Generation Report | Deployment | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |