Main Content

Specify Size of Requirements Table Block Data

You can specify the size of the data in Requirements Table blocks with the Symbols pane and Property Inspector, or with the Model Explorer. Requirements Table blocks can use scalars, vectors, or matrices. For more information about creating, deleting, and setting properties for data, see Define Data in Requirements Table Blocks and Set Data Types in Requirements Table Blocks. You can set data to inherit the size or manually specify the size.

Inherit Size from Specified Source

If you want data to inherit its size from a port, constant value, specified value, or a parameter, set the Size property to -1. The Scope property determines the source of where the data inherits size.

ScopeDescription
InputInherits size from the Simulink® signal connected to the associated input port.
OutputInherits size from the Simulink signal connected to the associated output port.
ConstantInherits size from the assigned value shown in the Symbols pane.
LocalInherits size from the assigned value.
ParameterInherits size from the associated Simulink or MATLAB® parameter.

Manually Specify Data Sizes

You can manually set the size of data to a scalar, vector, or matrix. To specify the size as a scalar, set Size to 1 or clear the property. To specify the size as a vector or a matrix, enter a row vector with positive integers in [row column] format. For example, to define a column vector of size 6, set the Size property to [6 1]. To define a row vector of size 5, set the Size property to [1 5]. To define a matrix of data size 3-by-3, set the Size property to [3 3].

You can also set the Size property with an expression. The expressions can include:

  • A numeric constant

  • Arithmetic operators, restricted to +, -, *, and /

  • Names of data with the Scope property set to Parameter

  • Calls to the MATLAB functions min, max, and size

These expressions must output a positive integer or two positive integers in [row column] format. Otherwise, the specified size produces an error at model compilation. For example, consider a Requirements Table block with data k, x, and y that have the Scope property set to Parameter. Here, k is a positive integer and x and y are matrices. If you create new data for the block, you can define the Size property with any of the following expressions:

k+1
size(x)
min(size(y))

Simulation and Size Matching

After you build the model, the CompiledSize column in the Model Explorer displays the actual size used in the simulation. If the value of the Size property is not -1 and does not match the actual size, a mismatch error occurs during model compilation.

See Also

Related Topics