Main Content

slreq.View

View settings

Since R2022b

    Description

    Use slreq.View objects to apply and manage the view settings for the Requirements Editor and Requirements Perspective.

    Creation

    Create a View object by using create.

    Properties

    expand all

    View name, specified as a character vector or string scalar.

    Example: "myView"

    Requirement filter, specified as a character array or a string scalar. The contents of the character vector or string scalar must be formatted as a cell array.

    Example: "{'ReqType','Functional'};"

    Link filter, specified as a character array or a string scalar. The contents of the character vector or string scalar must be formatted as a cell array.

    Example: "{'LinkType','Relate'};"

    This property is read-only.

    Host requirement set that the view is stored in, returned as a character array. If the view is in the preferences folder, the host is empty.

    Object Functions

    activateApply view settings
    activateDefaultViewApply default view settings
    createCreate view settings
    deleteDelete view settings
    getActiveViewGet applied view settings
    getErrorMessageGet view settings error message
    getViewsGet available views
    isValidCheck validity of view settings

    Examples

    collapse all

    This example shows how to create a view and apply it to the Requirements Editor and Requirements Perspective.

    Open the myAddRequirements requirement set, which contains requirements with Type set to Functional.

    rs = slreq.open("myAddRequirements");

    Create a view with the name NewView.

    myView = slreq.View.create("NewView")
    myView = 
      View with properties:
    
              Name: 'NewView'
         ReqFilter: ''
        LinkFilter: ''
              Host: ''
    
    

    Set the requirement filter to only display requirements that have Type set to Container.

    myView.ReqFilter = "{'ReqType','Container'};"
    myView = 
      View with properties:
    
              Name: 'NewView'
         ReqFilter: '{'ReqType','Container'};'
        LinkFilter: ''
              Host: ''
    
    

    Check if the view is valid.

    tf = isValid(myView)
    tf = logical
       1
    
    

    Apply the view to the Requirements Editor and Requirements Perspective.

    activate(myView)

    Confirm that the active view is NewView.

    appliedView = slreq.View.getActiveView
    appliedView = 
      View with properties:
    
              Name: 'NewView'
         ReqFilter: '{'ReqType','Container'};'
        LinkFilter: ''
              Host: ''
    
    

    The myAddRequirements requirement set does not contain any requirements with Type set to Container, so all of the requirements are filtered out.

    filtered-requirements-editor.png

    Version History

    Introduced in R2022b