document generated code with simulink report generator
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
system target file 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:
a simulink report generator license is required for the following report formats: pdf, rtf, microsoft word, and xml. for more information on generating reports in these formats, see the simulink report generator documentation.
generate code for the model
before you use the report generator to document your project, 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
slexaircraftexample
model. in the command window, enter:openexample('slexaircraftexample')
on the simulation tab, in the save list, select save as. navigate to the working folder,
report_ex
, and save a copy of theslexaircraftexample
model asmymodel
.open the configuration parameters dialog box. set the solver > solver selection > type parameter to
fixed-step
.select the code generation pane. select generate code only.
click apply.
in the model window, press ctrl b. the build process generates code for the model.
open the report generator
after you generate the code, open the report generator.
open the report generator app. in the model diagram window, in the apps gallery, click report generator.
in the report explorer window, in the options pane (center), click the folder rtw (\toolbox\rtw). click 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).
set report name, location, and format
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 replaceindex
with the namemymodelcgreport
.for file format, specify
rich text format
and replacestandard print
withnumbered chapters & sections
.
include models and subsystems in a report
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*.
customize the report
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.
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.
in the report explorer window, expand the node section 1 — generated code listing.
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.
generate the report
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.
when the report is complete, open the report,
mymodelcgreport.rtf
in the folder report_ex
(in this example).