| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
| On this page… |
|---|
To examine or specify the size of an argument, follow these steps:
From the Embedded MATLAB Editor, select Model Explorer or Tools > Edit Data/Ports.
In the Contents pane, click the row that contains the data argument.
Enter the size of the argument in one of two places:
Size field of the Data properties dialog, located in the Dialog pane
Size column in the row that contains the data argument, located in the Contents 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 Parameter Arguments in Embedded MATLAB Functions. |
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.
Note No arguments with inherited sizes are allowed for Embedded MATLAB Function blocks in a library. |
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
The number of dimensions equals the length of the vector.
The 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:
Numeric constants
Arithmetic operators, restricted to +, -, *, and /
Parameters defined in the MATLAB Workspace or the parent Simulink masked subsystem
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 in the Contents pane displays the actual size used in the compiled simulation application.
![]() | Typing Function Arguments | Parameter Arguments in Embedded MATLAB Functions | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |