Stateflow User's Guide Previous page   Next Page

Sizing Data by Expression

You set the Size property for an array in [row column page] format. For example, a value of [2 4] defines a 2-by-4 matrix in [row column] format. To define a row vector of size 5, set the Size to [1 5]. To define a column vector of size 6, set the Size property to [6 1] or just 6.

You can enter a MATLAB expression for each element (row, column, page) in the Size field that uses one or more of the following:

By using parameterized sizing, you can quickly resize large numbers of data by changing the size of a single Simulink parameter or MATLAB variable. If k, x, and y are Stateflow data of scope Constant or Parameter, the following examples are valid expressions that you can enter in the Size field of other data:

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 Stateflow block input variable uin is sized by the expression x+y.

x is a local data with the scope Parameter that takes its value from the parameter x for the masked subsystem containing the Stateflow block. Its value is initialized to 2.1. y is a local variable of scope Constant initialized to 3.9. x+y is therefore 6.


Previous page  Inheriting Input and Output Data Size from Simulink Using Actions in Stateflow Next page

© 1994-2005 The MathWorks, Inc.