|On this page…|
To examine or specify the size of an argument, follow these steps:
Enter the size of the argument in the Size field of the Data properties dialog, located in the General pane.
Note: The default value is -1, indicating that size is inherited, as described in Inheriting Argument Sizes from Simulink.
Size defaults to -1, which means that the data argument inherits its size from Simulink® based on its scope:
|For Scope||Inherits Size|
|Input||From the Simulink input signal connected to the argument.|
|Output||From the Simulink output signal connected to the argument.|
|Parameter||From the Simulink or MATLAB® parameter to which it is bound. See Add Parameter Arguments.|
After you compile the model, the Compiled Size column in the Contents pane displays the actual size used in the compiled simulation application.
The size of an output argument is the size of the value that is assigned to it. If the expected size in the Simulink model does not match, a mismatch error occurs during compilation of the model.
The size of a data argument can be a scalar value or a MATLAB vector of values.
To specify size as a scalar, set the Size field to 1 or leave it blank. To specify Size as a vector, enter an array of up to two dimensions in [row column] format where
Number of dimensions equals the length of the vector.
Size of each dimension corresponds to the value of each element of the vector.
For example, a value of [2 4] defines a 2-by-4 matrix. To define a row vector of size 5, set the Size field to [1 5]. To define a column vector of size 6, set the Size field to [6 1] or just 6. You can enter a MATLAB expression for each [row column] element in the Size field. Each expression can use one or more of the following elements:
Arithmetic operators, restricted to +, -, *, and /
The following examples are valid expressions for Size:
k+1 size(x) min(size(y),k)
In these examples, k, x, and y are variables of scope Parameter.
Once you build the model, the Compiled Size column displays the actual size used in the compiled simulation application.