Main Content

RequirementRow

Work with requirements in Requirements Table block

Description

RequirementRow objects represent requirements in Requirements Table blocks. Use the objects to programmatically adjust the requirement properties.

Creation

There are several ways to create a RequirementRow object:

  • Create a new requirement in a Requirements Table block by using the addRequirementRow object function.

  • Create a requirement interactively in the Requirements Table block, then get the associated RequirementRow object by using the getRequirementRows object function.

Properties

expand all

Action expressions, specified as a cell array of character vectors. For more information on actions, see Use a Requirements Table Block to Create Formal Requirements.

Data Types: cell | char

Duration expression, entered as a string scalar or character vector.

Data Types: char | string

This property is read-only.

Index of the requirement, returned as a character vector. When you create a new requirement, the software automatically assigns the requirement a unique index.

Precondition expressions, specified as a cell array of character vectors. You can also use the addRequirementRow object function to set the Precondition property when you create the RequirementRow object.

Example: reqRow.Preconditions = {'u1 > 0','','u3 > 0'} specifies the preconditions in a requirement with u1 > 0 in the first Precondition column, nothing in the second Precondition column, and u3 > 0 in the third Precondition column.

Data Types: cell | char

Postcondition expressions, specified as a cell array of character vectors.

Example: reqRow.Postconditions = {'u1 > 0','','u3 > 0'} specifies the postconditions in a requirement with u1 > 0 in the first Postcondition column, nothing in the second Postcondition column, and u3 > 0 in the third Postcondition column.

Data Types: cell | char

Requirement summary text, specified as a string scalar or character vector. Use this property to add text to the Summary column in the Requirements tab of the Requirements Table block.

Data Types: char | string

Object Functions

addChildAdd child requirement or assumption to Requirements Table block
getChildrenRetrieve child requirements and assumptions in Requirements Table block
clearClear row in Requirements Table block
removeRowRemove Requirements Table block row

Examples

collapse all

In a RequirementsTable object named reqTable, add two additional requirements.

addRequirementRow(reqTable);
addRequirementRow(reqTable);

Retrieve the RequirementRow objects.

rRow = getRequirementRows(reqTable);

Set the preconditions for the requirements.

rRow(1).Preconditions = {'u1 > 1'};
rRow(2).Preconditions = {'u1 > 0'};
rRow(3).Preconditions = {'u1 > -1'};

Set the postconditions for the requirements.

rRow(1).Postconditions = {'u2 > 1'};
rRow(2).Postconditions = {'u2 > 0'};
rRow(3).Postconditions = {'u2 < -1'};

Version History

Introduced in R2022a