Main Content

getAttribute

Class: slreq.Link
Package: slreq

Get link custom attributes

Syntax

val = getAttribute(myLink,name)

Description

val = getAttribute(myLink,name) returns the custom attribute value of the custom attribute specified by name for the link myLink.

Input Arguments

expand all

Link, specified as an slreq.Link object.

Custom attribute name, specified as a character array.

Output Arguments

expand all

Custom attribute value, returned as a character array, double, logical, or datetime. The data type depends on the custom attribute type.

Examples

expand all

This example shows how to get the attribute value of a specified custom attribute for a link.

Load the crs_req requirement files, which contain links for a cruise control system. Find the link set.

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

Create a links array containing all the links from link set ls. Get one link from the array. Get the attribute value of the custom attribute called Target Speed Change, which tracks whether linked requirements are related to incrementing or decrementing the speed.

linksArray = find(ls);
myLink = linksArray(7);
val = getAttribute(myLink,'Target Speed Change')
val = 
'Decrement'

Cleanup

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

slreq.clear;
bdclose all;
Introduced in R2020b