| Using Simulink | ![]() |
Specifying Argument Sizes with Expressions
You specify the size of an argument or return value for an Embedded MATLAB Function block in the Size field of the Model Explorer in [row column] format. 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:
1, 3, 7.54, and so on.
+, -, *, and /.
min, max, and size
The following examples are valid expressions for the Size field for an argument:
where k, x, and y are variables of scope Parameter.
Once you build the model, the CompiledSize column of the Model Explorer gives the actual size used in the compiled simulation application. In the following example, the Embedded MATLAB Function block input argument uin is sized by the expression x+y.
x is a local variable with scope Parameter that takes its value from the parameter x for the masked subsystem containing the Embedded MATLAB Function block. Its value is initialized to 2.1 (not shown). y is a local variable of Constant scope initialized to 3.9. x+y is therefore 6.
| Inheriting Argument Sizes from Simulink | Parameter Arguments in Embedded MATLAB Functions | ![]() |
© 1994-2005 The MathWorks, Inc.