Main Content

slreq.matrix.Configuration

Traceability matrix configuration

Since R2024a

    Description

    Use slreq.matrix.Configuration objects to define the configuration of artifacts and filters in a traceability matrix.

    Creation

    Use slreq.matrix.Configuration to create a traceability matrix configuration object. You can also use the slreq.getTraceabilityMatrixOptions function and retrieve the traceability matrix configuration object from the options field of the matrix options structure.

    Description

    example

    configuration = slreq.matrix.Configuration creates a traceability matrix configuration object.

    Properties

    expand all

    Artifacts on the left side of the traceability matrix, specified as a cell array of character vectors.

    Data Types: cell

    Artifacts on the top side of the traceability matrix, specified as a cell array of character vectors.

    Data Types: cell

    Left artifact filters, specified as an array of slreq.matrix.Filter objects.

    Top artifact filters, specified as an array of slreq.matrix.Filter objects.

    Matrix highlighting, specified as an array of slreq.matrix.Filter objects.

    Cell filters, specified as an array of slreq.matrix.Filter objects.

    Matrix settings filters, specified as an array of slreq.matrix.Filter objects.

    Object Functions

    addFilterToCellAdd cell filter to traceability matrix configuration
    addFilterToHighlightAdd highlighting to traceability matrix configuration
    addFilterToLeftAdd filter to left artifacts in traceability matrix configuration
    addFilterToMatrixAdd matrix settings filter to traceability matrix configuration
    addFilterToTopAdd filter to top artifacts in traceability matrix configuration
    exportToScriptExport traceability matrix configuration to script

    Examples

    collapse all

    This example shows how to create and edit a traceability matrix configuration object.

    Open the project and create a traceability matrix configuration.

    openProject("CruiseRequirementsExample");
    configuration = slreq.matrix.Configuration;

    Add artifacts to the traceability matrix configuration.

    configuration.LeftArtifacts ="documents\crs_req_func_spec.slreqx";
    configuration.TopArtifacts = "models\crs_controller.slx";

    Add filters to the traceability matrix configuration.

    %Create a filter and add it to the left side of the matrix
    leftFilter = slreq.matrix.Filter;
    leftFilter.Group ="Type";
    leftFilter.Type ="Functional";
    addFilterToLeft(configuration,leftFilter);
    
    %Create a filter and add it to the top of the matrix
    topFilter = slreq.matrix.Filter;
    topFilter.Group ="Type";
    topFilter.Type ="Subsystem";
    addFilterToTop(configuration,topFilter);

    Get an empty traceability matrix options structure and add the configuration object.

    matrixOpts = slreq.getTraceabilityMatrixOptions;
    matrixOpts.options = configuration;

    Generate the traceability matrix.

    slreq.generateTraceabilityMatrix(matrixOpts)

    Close the Requirements Editor.

    slreq.clear

    This example shows how to add filters to the left and top sides of a traceability matrix view.

    Open the project and get the traceability matrix configuration from the matrix options.

    openProject("CruiseRequirementsExample");
    view = slreq.getTraceabilityMatrixOptions("data\crs_req_tm_view.json");
    configuration = view.options;

    Create a functional requirement filter and add it to the left side of the traceability matrix.

    leftFilter = slreq.matrix.Filter;
    leftFilter.Group ="Type";
    leftFilter.Type ="Functional";
    addFilterToLeft(configuration,leftFilter);

    Create a subs filter and add it to the top of the traceability matrix.

    topFilter = slreq.matrix.Filter;
    topFilter.Group ="Type";
    topFilter.Type ="Subsystem";
    addFilterToTop(configuration,topFilter);

    Generate the updated traceability matrix.

    slreq.generateTraceabilityMatrix(view);

    Clear and close the Requirements Editor.

    slreq.clear

    This example shows how to add matrix setting and cell filters to a traceability matrix configuration, then generate the updated matrix.

    Open the project and get the traceability matrix configuration from the matrix options.

    openProject("ShortestPathChangesExample");
    view = slreq.getTraceabilityMatrixOptions("src\shortestPath_tm.json");
    configuration = view.options;

    Create a cell filter and add the filter to the configuration.

    cellFilter = slreq.matrix.Filter;
    cellFilter.Group = "Type";
    cellFilter.Type = "Implement";
    addFilterToCell(configuration,cellFilter);

    Create a matrix settings filter and add the filter to the configuration.

    matrixFilter = slreq.matrix.Filter;
    matrixFilter.Group = "Matrix";
    matrixFilter.Type =  "HasChangedLink";
    addFilterToMatrix(configuration,matrixFilter);

    Generate the updated traceability matrix.

    slreq.generateTraceabilityMatrix(view);

    Clear and close the Requirements Editor.

    slreq.clear

    This example shows how to highlight items in a traceability matrix by adding filters to a saved traceability matrix view.

    Open the project and get the traceability matrix configuration from the matrix options.

    openProject("CruiseRequirementsExample");
    view = slreq.getTraceabilityMatrixOptions("data\crs_req_tm_view.json");
    configuration = view.options;

    Create a highlight filter for missing links and add the filter to the configuration.

    noLinkFilter = slreq.matrix.Filter;
    noLinkFilter.Group ="Highlight";
    noLinkFilter.Type ="HasNoLink";
    addFilterToHighlight(configuration,noLinkFilter);

    Generate the updated traceability matrix.

    slreq.generateTraceabilityMatrix(view);

    Clear and close the Requirements Editor.

    slreq.clear

    Version History

    Introduced in R2024a