| Contents | Index |
| On this page… |
|---|
When you use Model-Based Design and production code generation to develop application software components, you can generate a traceability matrix. The traceability matrix provides traceability among model objects, generated code, and model requirements. You can add comments to the generated traceability matrix. If you change the model and regenerate the traceability matrix, the software retains your comments.
For a given model, the generated traceability matrix can provide information about:
Model objects that are traceable between the model and generated code, such as Simulink blocks, Stateflow objects, and MATLAB functions.
Model objects that are untraceable between the model and generated code, such as eliminated and virtual blocks.
Requirements documents that you link to model objects using the Simulink Verification and Validation Requirements Management Interface (RMI).
Generate the traceability matrix using either the iec.ExportTraceReport function from the MATLAB Command Window or the Generate Traceability Matrix button in the generated HTML code generation report for your model. Either method creates an XLS file that contains the following worksheets:
Report — Traceability information for each model object, including model, generated code, and requirements. Each row in the worksheet pertains to a single occurrence of a model object. The information for a model object is in more than one row if the object:
Appears more than once in the generated code.
Links to more than one requirement.
Model Information — Summary of the model configuration and checksum. The summary includes the model name, version, author, creation date, last saved by, last updated date, checksum, and the selection of Traceability Report Contents parameters.
Code Interface — Information about the generated code interface, such as function prototype and timing information for the model initialize and step functions.
Code Files — File folders and names of the generated code files.
Before generating a traceability matrix for model objects, generated code, and model requirements, perform the following steps:
Optionally, attach requirements documents. For more information, see Requirements Traceability in the Simulink Verification and Validation documentation.
In the Configuration Parameters dialog box, on the Code Generation > Report pane, select:
At least one of the following Traceability Report Contents parameters:
Tip If you want to generate the traceability matrix directly from the code generation report, select Launch report automatically. |
Generate code for the model.
To generate a traceability matrix:
Open the model if it is not already open.
Ensure that you have completed the Prerequisites for Generating a Traceability Matrix.
Generate the traceability matrix using one of the following methods:
In the MATLAB Command Window, enter the following command, where model_name is the name of the model:
iec.ExportTraceReport('model_name')The software generates the traceability matrix.
Open the code generation report for the model if it is not already open. Go to the Traceability Report section and click the Generate Traceability Matrix button. For example:

When you click the button, the Generate Traceability Matrix dialog box appears.

You can use this dialog box to browse to an existing matrix file to update or specify a new matrix file to create. Optionally, you can also use this dialog box to select and order the columns that appear in the generated matrix. Click OK to update or create the specified report.
Review the traceability matrix and add comments in new columns. For more information, see Adding Comments to a Traceability Matrix.
![]() | Supporting Certification-Related Development Activities | Adding Comments to a Traceability Matrix | ![]() |

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 |