Main Content

getAttribute

Class: slreq.Reference
Namespace: slreq

Get referenced requirement custom attributes

Syntax

val = getAttribute(ref,propertyName)

Description

val = getAttribute(ref,propertyName) returns the value of the referenced requirement property or custom attribute specified by propertyName.

Input Arguments

expand all

Referenced requirement, specified as a slreq.Reference object.

Referenced requirement property or custom attribute name, specified as a string scalar or character vector.

Example: "Priority"

Output Arguments

expand all

Referenced requirement property or custom attribute value, returned as a string scalar, character vector, double, logical, or datetime. The data type depends on the property type or custom attribute type.

Example: "High"

Examples

expand all

This example shows how to get the value of a custom attribute for a referenced requirement.

Load a requirement set called My_Requirement_Set.

rs = slreq.load('C:\MATLAB\My_Requirements_Set.slreqx');

Find the referenced requirement with ID R20.1.

ref1 = find(rs,Type="Reference",ID="R20.1");

Get the value of the Priority custom attribute for the referenced requirement.

val = getAttribute(ref1,"Priority")
val = 

    "Low"

Version History

Introduced in R2018a