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

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

    example

    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 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. Then, add the matrix artifacts and configuration object.

    matrixOpts = slreq.getTraceabilityMatrixOptions;
    matrixOpts.leftArtifacts = "documents\crs_req_func_spec.slreqx";
    matrixOpts.topArtifacts = "models\crs_controller.slx";
    matrixOpts.options = configuration;

    Generate the traceability matrix.

    slreq.generateTraceabilityMatrix(matrixOpts);

    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(fullfile("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);

    Add the matrix artifacts and generate the updated traceability matrix.

    configuration.LeftArtifacts = fullfile("documents","crs_req_func_spec.slreqx");
    configuration.TopArtifacts = fullfile("models","crs_controller.slx");
    slreq.generateTraceabilityMatrix(view);

    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(fullfile("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);

    Add the matrix artifacts and generate the updated traceability matrix.

    configuration.LeftArtifacts = fullfile("requirements","shortest_path_func_reqs.slreqx");
    configuration.TopArtifacts = fullfile("src","shortest_path.m");
    slreq.generateTraceabilityMatrix(view);

    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(fullfile("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);

    Add the matrix artifacts and generate the updated traceability matrix.

    configuration.LeftArtifacts = fullfile("documents","crs_req_func_spec.slreqx");
    configuration.TopArtifacts = fullfile("models","crs_controller.slx");
    slreq.generateTraceabilityMatrix(view);

    Version History

    Introduced in R2024a