Main Content

Code Tracing

Trace between generated code and corresponding blocks in a model

Code tracing enables easy navigation between a line of generated code and its corresponding elements in a model for code verification. To verify your generated code:

  • Trace between generated code and model elements by using these types of navigation:

    • Code-to-model: Trace code to model elements using hyperlinks in the code generation report.

    • Model-to-code: Trace model elements back to corresponding lines of the generated code.

  • Link generated code to the model element requirements. Using configuration parameters, you can specify whether to include requirement descriptions as comments in the generated code.

Functions

rtwtraceTrace a block to generated code in code generation report

Topics

Verify Generated Code by Using Code Tracing

Code tracing enables navigation between generated code and its corresponding elements in a model.

Trace Simulink Model Elements in Generated Code

Trace Simulink® model elements by using code-to-model and model-to-code traceability in the code generation report.

Trace Stateflow Elements in Generated Code

Trace different Stateflow® elements to corresponding lines in generated code.

Reload Existing Traceability Information

Example of how to reload existing traceability information for a model.

Customize Traceability Reports

Obtain complete mapping between model elements and generated code.

Use Traceability in MATLAB Function Blocks

Trace between source code and generated code in a MATLAB Function block.

Featured Examples