Main Content

slreq.getTraceabilityMatrixOptions

Create options structure for traceability matrix

Since R2021a

    Description

    opts = slreq.getTraceabilityMatrixOptions creates an empty traceability matrix options structure.

    example

    opts = slreq.getTraceabilityMatrixOptions('current') creates a traceability matrix options structure containing the artifacts from the selected tab in the Traceability Matrix window.

    example

    Examples

    collapse all

    This example shows how to create an options structure for a traceability matrix, then generate a matrix using those options.

    Open the Requirements Definition for a Cruise Control Model project.

    openProject("ShortestPath");

    Create an options structure for a traceability matrix.

    opts = slreq.getTraceabilityMatrixOptions;

    Set the leftArtifacts and topArtifacts fields of opts. Enter a cell array containing the name of the artifacts that you want to use in your traceability matrix.

    opts.topArtifacts = ["shortest_path_func_reqs.slreqx","shortest_path_tests_reqs.slreqx"];
    opts.leftArtifacts = "graph_unit_tests";

    Generate the traceability matrix with the artifacts specified by opts.

    slreq.generateTraceabilityMatrix(opts)

    This example shows how to get the artifacts from the selected tab in the Traceability Matrix window, then re-generate the matrix.

    Open the Project

    Open the ShortestPath project.

    openProject("ShortestPath");

    Open the shortest_path.m code file, then open the Traceability Matrix window.

    open shortest_path.m
    slreq.generateTraceabilityMatrix

    Create the Traceability Matrix

    1. In the Traceability Matrix window, click Add.

    2. In the Select Artifacts dialog, set Left to shortest_path_func_reqs.slreqx and Top to shortest_path.m.

    3. Click Generate Matrix.

    Get Artifacts from the Traceability Matrix

    Get the artifacts that were used to generate the matrix.

    opts = slreq.getTraceabilityMatrixOptions('current');

    Close the Traceability Matrix window. Re-generate the matrix with the artifacts specified by opts.

    slreq.generateTraceabilityMatrix(opts)

    Output Arguments

    collapse all

    Traceability matrix options, specified as a struct with these fields:

    • leftArtifacts

    • topArtifacts

    • openArtifactSelector

    • options

    Version History

    Introduced in R2021a