setAttribute
Class: slreq.Link
Package: slreq
Set link custom attributes
Syntax
setAttribute(myLink,name,value)
Description
setAttribute(
sets the value specified by myLink
,name
,value
)value
of the custom attribute specified by
name
for the link myLink
.
Input Arguments
myLink
— Link
slreq.Link
object
Link, specified as an slreq.Link
object.
name
— Custom attribute name
character array
Custom attribute name, specified as a character array.
value
— Custom attribute value
character array | double
| logical
, | datetime
Custom attribute value, specified as a character array, double
,
logical
or datetime
. The data type depends on
the custom attribute type.
Examples
Set Link Attribute Value
This example shows how to set 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.
slreq.load('crs_req'); slreq.load('crs_req_func_spec');
Create a links array containing all links. Get one link from the array.
linksArray = slreq.find('Type','Link')
linksArray=1×12 object
1x12 Link array with properties:
Type
Description
Keywords
Rationale
CreatedOn
CreatedBy
ModifiedOn
ModifiedBy
Revision
SID
Comments
lk = linksArray(1);
Custom attribute Target Speed Change
, tracks whether the linked requirements are related to incrementing or decrementing the speed, or not related at all. Set the value of Target Speed Change
to Unset
for your link. Then use getAttribute
to confirm that the value was set correctly.
setAttribute(lk,'Target Speed Change','Unset'); value = getAttribute(lk,'Target Speed Change')
value = 'Unset'
Cleanup
Clean up commands. Clear the open requirement sets and close the open models without saving the changes.
slreq.clear;
bdclose all;
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)