Main Content

Link Safety Analysis Manager Spreadsheet Cells and Rows to Linkable Items

If you have a Requirements Toolbox™ license, you can define the traceability between cells (since R2023b) and rows (since R2024b) in Safety Analysis Manager spreadsheets by linking cells and rows to other linkable items. Linkable items in Simulink® include requirements, test cases, faults, conditionals, and other Safety Analysis Manager spreadsheet cells and rows. For a list of linkable items, see Linkable Items (Requirements Toolbox).

To link artifacts in the Safety Analysis Manager, you must save the document first. When you link spreadsheet cells or rows, the Requirements Toolbox software stores the links in a SLMX file by default.

Link Cells and Rows to Requirements

Link Safety Analysis Manager cells and rows to requirements to specify design requirements in your spreadsheets. Before you begin, in the Apps tab, open Safety Analysis Manager and the Requirements Editor.

To link Safety Analysis Manager cells to requirements:

  1. In the Requirements Editor, open or create a new requirement set with at least one requirement. See Author Requirements in MATLAB or Simulink (Requirements Toolbox).

  2. Click the requirement.

  3. In a saved Safety Analysis Manager, spreadsheet with at least one row and one column, right-click the cell or row index and select Requirements > Link to Selection in Requirements Browser.

You can view the links in the Requirements Editor by clicking Show Links in the View section. In the right pane, the Source field of a link from a cell includes the spreadsheet cell badge , the name of the spreadsheet that contains the cell, the cell row index, and the cell column label.

This image shows the fault badge for the Requirements Editor in the Source field of a link.

The Source field of a link from a row includes the spreadsheet row badge , the name of the spreadsheet that contains the row, and cell row index.

You can also see the cells and rows linked to each requirement in the requirements view. In the View section, click Show Requirements and select a requirement. Links to cells and rows display in the Links section. Links to cells have the spreadsheet cell badge and links to rows have the spreadsheet row badge . In this example image, a spreadsheet row links to the requirement.

This image shows the fault badge for the Requirements Editor in the Links section when viewing the requirement link to the spreadsheet row.

Link Spreadsheet Cells and Rows to Simulink Test Artifacts

If you have a Requirements Toolbox and Simulink Test™ license, you can link cells and rows to Simulink Test objects, such as test files, test suites, and test cases.

To link test cases to cells or rows:

  1. In the Apps tab, click Simulink Test.

  2. Open the Test Manager. In the Tests tab, in the Test Cases section, click Simulink Test Manager.

  3. Load or create a test suite or test file and click the test case. The test suite or test file must have at least one test case. For more information on how to create a test case, see Create a Simple Baseline Test (Simulink Test).

  4. Click the test case.

  5. In a saved Safety Analysis Manager spreadsheet that contains at least one cell, right-click the cell or row index and select Requirements > Link to Current Test Case.

Link to Simulink Fault Analyzer Artifacts

You can create links to conditionals, faults, or to other Safety Analysis Manager spreadsheet or rows.

Link Cells or Rows to Faults

To create links to faults:

  1. In a Simulink model, open the Fault Table pane. In the Fault Analyzer tab, in the View section, click Fault Table.

  2. In the Fault Table pane, click the Fault tab.

  3. Expand the model element list and click the fault.

  4. In a saved Safety Analysis Manager spreadsheet that contains at least one cell, right-click the cell or row index and select Requirements > Link to Selection in Fault Table.

Link Cells or Rows to Conditionals

To create links to conditionals:

  1. Open the Fault Table pane.

  2. Click the Conditional tab.

  3. Click the conditional.

  4. In a saved Safety Analysis Manager spreadsheet that contains at least one cell, right-click the cell and select Requirements > Link to Selection in Fault Table.

Link to Other Spreadsheet Cells and Rows

You can link between cells or rows in the same or a different spreadsheet. To create links to other spreadsheet cells or rows in the Safety Analysis Manager:

  1. Create and save a new spreadsheet or open an existing spreadsheet that contains at least two cells.

  2. Right-click the cell or row, and select Requirements > Select for Linking in Safety Analysis Manager.

  3. In the same or a different spreadsheet, right-click the other cell or row, and select Requirements > Link to Selection in Safety Analysis Manager.

The first artifact you select has the incoming link icon and the second artifact has the outgoing link icon . If you click the spreadsheet cell or row, the Properties pane displays the link and the direction in the Cell or Row tab, depending on what you select.

An example of the link information shown in the Properties pane. The link has the arrow pointing left, indicating that the link is incoming.

Programmatically Link Spreadsheet Cells and Rows

You can also programmatically link spreadsheet cells and rows in the Safety Analysis Manager. For example, suppose that you have a spreadsheet open in the Safety Analysis Manager and a requirement set called my_requirements. To link the cell in the first column and first row of a spreadsheet to the first requirement, and then link the second row to the first requirement:

  1. Retrieve the Spreadsheet object associated with the spreadsheet by using the safetyAnalysisMgr.getOpenDocuments function.

    mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;
  2. Get the SpreadsheetCell object associated with the cell in the first row and first column by using the getCell function.

    myCell = getCell(mySpreadsheet,1,1);

  3. Get the SpreadsheetRow object associated with the second row by using the getRow function.

    myRow = getRow(mySpreadsheet,2);
  4. Load the requirement set by using the slreq.load (Requirements Toolbox) function.

    rs = slreq.load("my_requirements");

  5. Get the first requirement with the find function.

    req = find(rs,Index=1);

  6. Link the requirement to the cell and row.

    link1 = slreq.createLink(myCell,req);
    link2 = slreq.createLink(myRow,req);

See Also

Apps

Functions

Related Topics