Filter Requirements and Links in the Requirements Editor
You can filter requirements and links in the Requirements Editor and Requirements Perspective by creating a view that filters based on requirement and link metadata. You can share views with other users by sharing a MAT-file or by a requirement set that has views stored internally.
Create Views
To create a view:
Open the Filtered View Editor:
In the Requirements Editor, select Filter View
> Manage Views.
In the Requirements Perspective, click the Select View menu and select
Manage Views
.
In the Filtered View Editor, click New. Enter a name in the View name field.
To store the view in the preferences folder, set Storage type to
User
. For more information, see Where MATLAB Stores Preferences. To store the view in a requirement set, select the requirement set from the list next to Storage type. You cannot store a view in a link set.Note
When you store a view in a the requirement set, changes to the view do not cause the requirement set to have unsaved changes.
In the Requirements Filter and Links Filter tabs, define your filter criteria, then click OK. If you stored a view in the requirement set, save the requirement set.
Alternatively, you can save the current column layout and applied filters as a new view:
In the Requirements Editor, select Filter View
> Save View.
In the Requirements Perspective, click the Select View menu and select
Save View
.
In the Save View dialog, enter a name for the view and click OK. You can also overwrite an existing view by selecting it from the list.
Create Views Programmatically
To create a view programmatically, use create
.
Define Requirement and Link Filters
To define filter criteria in the Filtered View Editor, enter a cell array of
comma-separated name-value arguments with the same input syntax as slreq.find
. For example, to display only the requirements with
Type
set to Functional
, use this filter:
{"ReqType","Functional"};
Requirement filters apply to all loaded requirements, referenced requirements, and justifications. Link filters apply to all loaded links.
Define Filters Programmatically
To define filters programmatically, set the ReqFilter
and LinkFilter
properties of the slreq.View
object. Enter the filter as a string scalar or character
array that contains a cell array of comma-separated name-value arguments with the
same input syntax as slreq.find
.
For example, consider an slreq.View
object that is assigned to a variable called
myView
. To display only the requirements with
Type
set to Functional
,
enter:
myView.ReqFilter = "{'ReqType','Functional'};";
Apply Views
To apply a view in the Requirements Editor, click Filter
View
, then select a view from the list. To reset the view
to the default view, select Default view.
To apply a view in the Requirements Perspective, click the Select View menu and select a view from the list.
Apply Views Programmatically
To apply a view programmatically, use activate
. To reset the view to the default view, use activateDefaultView
.
Manage Views
To edit or delete a view, open the Filtered View Editor:
In the Requirements Editor, select Filter View
> Manage Views.
In the Requirements Perspective, click the Select View menu and select
Manage Views
.
To edit a view, select the view and edit the name or filter criteria. You cannot edit the storage location.
To delete a view, select the view and click Delete.
Manage Views Programmatically
To edit a view programmatically, edit the Name
, ReqFilter
, or LinkFilter
properties of the slreq.View
object.
To delete a view programmatically, use delete
.
Share Views
To share views with other users, you can share a:
Requirement set that has views stored in the set
User preferences MAT-file
Requirements Toolbox™ view settings MAT-file
To share a view stored in a requirement set, share the SLREQX file.
To share your views stored in your preferences folder, identify the location of your
preferences folder by using prefdir
. For more information, see
Where MATLAB Stores Preferences. Share the
MAT-file called slreqViewSettings_v2.mat
. Other users can place this
file in their preferences folder to use the views.
To share a Requirements Toolbox view settings as a MAT-file, use slreq.exportViewSettings
to export the currently loaded views. To import
the MAT-file, use slreq.importViewSettings
. The views are saved where they were originally
stored.