Main Content

find

Class: slreq.LinkSet
Package: slreq

Find links in link set with matching attribute values

Syntax

myLinks = find(myLinkSet,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN)

Description

myLinks = find(myLinkSet,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN) finds and returns all slreq.Link objects in the link set myLinkSet that match the properties specified by PropertyName and PropertyValue.

Input Arguments

expand all

Link set, specified as an slreq.LinkSet object.

Link property name, specified as a character vector. See the valid property names in the Properties section of slreq.Link.

Example: 'Type','Keywords','SID'

Link property value, specified as a character vector, character array, datetime value, scalar, logical, or structure array. The data type depends on the specified propertyName. See the valid property values in the Properties section of slreq.Link.

Example: 'Type','Keywords','SID'

Output Arguments

expand all

Link or link array, specified as an slreq.Link object.

Examples

expand all

This example shows how to find a link in a link set that matches the specified property value.

Load the crs_req requirement files, which contain links for a cruise control system. Define the link set by assigning it to a variable.

slreq.load('crs_req');
ls = slreq.find('Type','LinkSet');

Find a link that matches the specified SID.

myLink = find(ls,'SID','3')
myLink = 
  Link with properties:

           Type: 'Derive'
    Description: '#8: Set Switch Detection'
       Keywords: {}
      Rationale: ''
      CreatedOn: 20-May-2017 13:14:40
      CreatedBy: 'itoy'
     ModifiedOn: 09-Jun-2020 14:57:35
     ModifiedBy: 'ahoward'
       Revision: 5
            SID: 3
       Comments: [0x0 struct]

Find all links that are modified in the specified revision.

myLinks = find(ls,'Revision','7')
myLinks=1×8 object
  1x8 Link array with properties:

    Type
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedOn
    ModifiedBy
    Revision
    SID
    Comments

Find a link that matches the specified SID and revision.

myLink2 = find(ls,'SID','8','Revision','7')
myLink2 = 
  Link with properties:

           Type: 'Derive'
    Description: '#12: Increment Short Switch Detection'
       Keywords: {}
      Rationale: ''
      CreatedOn: 20-May-2017 13:15:45
      CreatedBy: 'itoy'
     ModifiedOn: 09-Jun-2020 15:14:55
     ModifiedBy: 'ahoward'
       Revision: 7
            SID: 8
       Comments: [0x0 struct]

Cleanup

Clean up commands. Clear the open requirement sets and link sets and close the open models without saving changes.

slreq.clear;
bdclose all;
Introduced in R2018a