move
Class: slreq.Requirement
Namespace: slreq
Syntax
tf = move(req1,location,req2)
Description
moves requirement tf
= move(req1
,location
,req2
)req1
under, before, or after requirement
req2
depending on the location specified by
location
. The function returns 1
if the move is
executed without error.
Input Arguments
req1
— Requirement
slreq.Requirement
object
Requirement to move, specified as an slreq.Requirement
object.
location
— Requirement move location
'under'
| 'before'
| 'after'
Requirement move location, specified as 'under'
,
'before'
, or 'after'
.
req2
— Requirement to move
slreq.Requirement
object
Requirement, specified as an slreq.Requirement
object.
Output Arguments
tf
— Paste success status
0
|
1
Paste success status, returned as a
1
or 0
of data type
logical
.
Examples
Move a Requirement
This example shows how to move a requirement under, before, or after another requirement.
Load the crs_req_func_spec
requirement file, which describes a cruise control system, and assign it to a variable. Find two requirements by index. The first requirement will be moved in relation to the second requirement.
rs = slreq.load('crs_req_func_spec'); req1 = find(rs,'Type','Requirement','Index','1'); req2 = find(rs,'Type','Requirement','Index','2');
Move Under a Requirement
Move the first requirement, req1
, under the second requirement, req2
. The first requirement becomes the last child requirement of requirement req2
, and req2
moves up one in the hierarchy, which you can verify by checking the index of req1
and req2
. The old indices of req1
and req2
were 1
and 2
, respectively.
tf = move(req1,'under',req2);
req1.Index
ans = '1.3'
req2.Index
ans = '1'
Move Before a Requirement
Move the first requirement, req1
, before the second requirement, req2
. Confirm that the requirement was moved correctly by checking the indices of req1
and req2
. The indices of req1
and req2
are now the same as they were originally: 1
and 2
, respectively.
tf = move(req1,'before',req2);
req1.Index
ans = '1'
req2.Index
ans = '2'
Move After a Requirement
Move the first requirement,req1
, after the second requirement, req2
. When you move requirement req1
down in the hierarchy, requirement req2
also moves up, which you can verify by checking the indices of req1
and req2
.
tf = move(req1,'after',req2);
req1.Index
ans = '2'
req2.Index
ans = '1'
Version History
Introduced in R2020b
See Also
slreq.Requirement
| copy
| moveDown
| moveUp
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)