Main Content

slreq.getTraceabilityMatrixOptions

Create options structure for traceability matrix

    Description

    example

    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.

    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.

    slreqCCProjectStart;

    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 traceabilty matrix.

    opts.leftArtifacts = {'crs_req.slreqx','crs_req_func_spec.slreqx'};
    opts.topArtifacts = {'crs_plant.slx', 'crs_controller.slx','DriverSwRequest_Tests.mldatx'};

    Generate the traceability matrix with the artifacts specified by opts.

    slreq.generateTraceabilityMatrix(opts)

    Cleanup

    Clear the open requirement sets and link sets, and close the Traceability Matrix window. Close the Requirements Definition for a Cruise Control Model project.

    slreq.clear;
    slproject.closeCurrentProject();

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

    Setup

    Open the Requirements Definition for a Cruise Control Model project.

    slreqCCProjectStart;

    Load the crs_controller model, then open the Traceability Matrix window.

    load_system('crs_controller');
    slreq.generateTraceabilityMatrix;

    Create the Traceability Matrix

    1. In the Traceability Matrix window, in the Select Artifacts dialog, set Left to crs_req_func.slreqx and Top to crs_controller.slx.

    2. Click Generate Matrix.

    Get Artifacts from the Traceability Matrix

    Without closing the Traceability Matrix window, get the artifacts that were used to generate the matrix.

    opts = slreq.getTraceabilityMatrixOptions('current')
    opts = struct with fields:
        leftArtifacts: {'C:\Users\jdoe\MATLAB\Projects\examples\CruiseRequirementsExample\documents\crs_req_func_spec.slreqx'}
         topArtifacts: {'C:\Users\jdoe\MATLAB\Projects\examples\CruiseRequirementsExample\models\crs_controller.slx'}
    
    

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

    slreq.generateTraceabilityMatrix(opts)

    Cleanup

    Clear the open requirement sets and link sets, and close the Traceability Matrix window.

    slreq.clear;

    Output Arguments

    collapse all

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

    • leftArtifacts

    • topArtifacts

    Version History

    Introduced in R2021a