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

    example

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

    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("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