Main Content

slreq.matrix.Filter

Filter for traceability matrix

Since R2024a

    Description

    Use slreq.matrix.Filter objects to apply filters to traceability matrices. After creating slreq.matrix.Filter objects, add the filters to slreq.matrix.Configuration objects.

    Creation

    Use slreq.matrix.Filter to create a traceability matrix configuration object. You can also use the slreq.getTraceabilityMatrixOptions function to access the slreq.matrix.Configuration object in the options field of the matrix options structure and retrieve filters from the LeftFilters, TopFilters, Highlight, Cell, and Matrix properties.

    Description

    filter = slreq.matrix.Filter creates a traceability matrix filter.

    example

    Properties

    expand all

    Artifact domain, specified as a string scalar or character vector. If you do not specify this property, the domain is set based on the artifact type.

    Example: "slreq", "simulink", "sltest"

    Data Types: char | string

    Filter group, specified as "Type", "Link", "ChangeTracking", "Highlight", or "Matrix".

    Data Types: char | string

    Type of filter, specified as a string scalar or character vector.

    Example: "Functional", "Container", "Informational"

    Data Types: char | string

    Display label of filter on the traceability matrix, specified as a string scalar or character vector. If you do not specify this property, the Label property is set to the Type property.

    Data Types: char | string

    Location to which to apply the filter, specified as "Row" for a left filter, "Col" for a top filter, "Cell" for a cell filter, or "Matrix" for a matrix settings filter.

    Data Types: char | string

    Examples

    collapse all

    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