Main Content

Requirements Traceability

Manage outgoing links for current file in MATLAB Editor

Since R2025a

Description

Use the Requirements Traceability panel to manage outgoing links for the current file in the MATLAB® Editor without opening the Requirements Editor. You can navigate to linked lines of code and link destinations, view link details, and delete links.

This image shows the Requirements Traceability panel. The panel contains 11 line ranges and 11 links.

Open the Requirements Traceability

  • MATLAB Editor: While editing a plain text file, right-click in the editor and select Requirements > Open Requirements Traceability Panel

Examples

expand all

To navigate to linked lines of code in the MATLAB Editor, open the Requirements Traceability panel and click an item that has the link destination icon . The MATLAB Editor selects the linked lines of code.

A GIF shows the mouse clicking an item that has the line range icon and the MATLAB Editor highlights the linked lines of code.

If requirements link to the wrong lines of code in the file, you can edit the line range.

To edit the line numbers in a line range:

  1. Select an item that has the line range icon . The editor selects the code in the line range.

  2. Unselect the code in the line range by clicking in the editor. Then, right-click in the line range and select Requirements > Adjust line range.

  3. In the Adjust range dialog box, use the + and - buttons to change the first and last lines of the line range. Alternatively, enter the line number in the field.

    Adjust range dialog box showing lines 1 and 2 as the first and last lines for the line range.

  4. Click OK.

  5. Save the link set by right-clicking in the MATLAB Editor and selecting Requirements > Save Links.

If the current file contains unused line ranges, you can delete them. To do so, select an item that has the line range icon , then press Delete. If the line range has outgoing links, a dialog box prompts you to also delete the outgoing links, or cancel.

To save the changes, save the link set by right-clicking in the editor and selecting Requirements > Save Links.

To navigate to a link destination, select an item that has the link destination icon , then click Show in document.

A looping GIF selects an item with the link destination icon, then opens the link destination by clicking the Show in document button.

To view details about a link destination, click an item that has the link destination icon . You can view the link type, the link destination file and domain, and the link destination ID.

An item that has the link destination is selected. The link details are displayed.

To view the link properties not shown in the Requirements Traceability panel, open the link in the Requirements Editor. In the Requirements Traceability panel, double-click an item that has the link destination icon .

A looping GIF shows the mouse double-clicking an item that has the link destination icon and the link opens in the Requirements Editor.

To delete a link, select an item that has the link destination icon , then press Delete.

Then, save the link set by right-clicking in the editor and selecting Requirements > Save Links.

To generate a traceability diagram for linked lines of code, double-click an item that has the line range icon . The starting node of the diagram is the line range. For more information, see Generate Traceability Diagrams.

A looping GIF demonstrates generating a traceability diagram by double-clicking an item that has the line range icon.

Orphan links are links that have invalid sources. Link sources from MATLAB code files become invalid if you delete the linked lines of code from the file. The Requirements Traceability panel displays the orphan links in red text.

The mouse points to the section of the panel that displays the orphan items in the link set.

To repair orphan links:

  1. Double-click an orphan item that has the line range icon . The Repair Invalid Links dialog box appears.

  2. In the MATLAB Editor, select the lines of code to link to.

  3. In the Repair Invalid Links dialog box, click Use current.

  4. Click OK.

  5. Save the link set by right-clicking in the MATLAB Editor and selecting Requirements > Save Links.

For more information about resolving links, see Load and Resolve Links.

Tip

Alternatively, you can delete orphan links and create new links. For more information about creating links, see Create Links.

Version History

Introduced in R2025a