Main Content

Document Generated Code

This example shows how to use the Simulink® Report Generator with Simulink® Coder™ to automatically generate documentation for a model and its generated code.

Open the model rtwdemo_codegenrpt.

model='rtwdemo_codegenrpt';
open_system(model)

Generate code for the model.

evalc('rtwbuild(''rtwdemo_codegenrpt'')');

After generating the code, Simulink Coder displays an HTML code generation report that includes embedded hyperlinks to the generated source files.

To generate a project document, use the Simulink Report Generator.

rtwreport('rtwdemo_codegenrpt');
    Beginning report
    Looping on model "rtwdemo_codegenrpt"
    Looping on system "rtwdemo_codegenrpt"
    Looping on system "Amplifier"
    Looping on system "Counter"
    Converting report
    Report complete

The generated report documents the model and the generated code. The report includes:

  • Snapshots of the model, including subsystems.

  • A block execution order list.

  • A summary of the generated code.

  • Full listings of generated code files in the build folder.

Close the model.

rtwdemoclean;
close_system(model,0)

If you have a Simulink Report Generator license, you can customize the generated document by using the Report Explorer.

Related Topics