| Stateflow® | ![]() |
You use the Data properties dialog box to set and modify the properties of data objects. Properties vary according to the scope and type of the data object. The Data properties dialog box displays only the property fields relevant to the data object you are defining. For example, the dialog box displays these properties and default values for a data object whose scope is Constant and type is Fixed point.

For many data properties, you can enter expressions or parameter values. Using parameters to set properties for many data objects simplifies maintenance of your model, because you can update multiple properties by changing a single parameter.
Use the General pane to define the name, scope, size, complexity, or type of a data object. See Properties You Can Set in the General Pane.
Use the Value Attributes pane to set an initial value, limit range, and index into a data object array. See Properties You Can Set in the Value Attributes Pane.
Use the Description pane to enter a data description and link to documentation about the data object. See Properties You Can Set in the Description Pane.
To open the Data properties dialog box, use one of these methods:
Add a new data object in the Stateflow Editor, as described in Adding Data Using the Stateflow Editor.
After you add the data object, the Data properties dialog box appears.
Open the Data properties dialog box from the Model Explorer for a data object that already exists in the Stateflow hierarchy. Use one of these techniques:
Double-click the data object in the Contents pane.
Right-click the data object in the Contents pane and select Properties.
Select the data object in the Contents pane and then select View > Dialog View.
The Data properties dialog box opens inside the Model Explorer.
For more information about adding data objects in the Model Explorer, see Adding Data Using the Model Explorer.
The General pane of the Data properties dialog box appears as shown.

You can set these properties in the General pane.
Name of the data object. Name length should comply with the maximum identifier length enforced by Real-Time Workshop code generation software. You can set this parameter in the Symbols pane of the Configuration Parameters dialog box (see Maximum identifier length in the Real-Time Workshop Reference documentation). The default length is 31 characters and the maximum length you can specify is 256 characters. The name can consist of any combination of alphanumeric and special characters; however, it cannot begin with a numeric character or contain embedded spaces.
Location where data resides in memory, relative to its parent. You can set scope to one of these values:
| Scope Value | Description |
|---|---|
| Local | Data defined in the current Stateflow chart only. |
| Constant | Read-only constant value that is visible to the parent Stateflow object and its children. |
| Parameter | Constant whose value is defined in the MATLAB workspace, or derived from a Simulink block parameter that you define and initialize in the parent masked subsystem. The Stateflow data object must have the same name as the parameter. See Mask Editor in Simulink software documentation for information on how to assign a parameter to a masked subsystem. See Sharing Simulink Parameters with Stateflow Charts to learn how to use Simulink block parameters with Stateflow charts. |
| Input | Input argument to a function if the parent is a graphical, truth table, or Embedded MATLAB function. Otherwise, the Simulink model provides the data to the Stateflow chart via an input port on the Stateflow block. See Sharing Input and Output Data with Simulink Models. |
| Output | Return value of a function if the parent is a graphical, truth table, or Embedded MATLAB function. Otherwise, the Stateflow chart provides the data to the Simulink model via an output port on the Stateflow block. See Sharing Input and Output Data with Simulink Models. |
| Data Store Memory | Data object that binds to a Simulink data store, which is a signal that functions like a global variable because all blocks in a model can access that signal. This binding allows the Stateflow chart to read and write the Simulink data store, thereby sharing global data with the model. The Stateflow object must have the same name as the Simulink data store. See Sharing Global Data with Simulink Models. |
| Temporary | Data that persists only during the execution of a function. You can define temporary data only for a graphical, truth table, or Embedded MATLAB function, as described in Defining Temporary Data. |
| Exported | Data from the Simulink model that is made available to external code defined in the Stateflow hierarchy, as described in Sharing Stateflow Data with External Modules. You can define exported data only for a Stateflow machine. |
| Imported | Data parented by the Simulink model that is defined by external code embedded in the Stateflow machine, as described in Sharing Stateflow Data with External Modules. You can define imported data only for a Stateflow machine. |
Index of the port associated with the data object. This property applies only to input and output data. See Sharing Input and Output Data with Simulink Models.
Option that specifies that output or local data explicitly inherits properties from Simulink.Signal objects of the same name in the MATLAB base workspace or the Simulink model workspace. The data can inherit these properties:
Size
Complexity
Type
Minimum value
Maximum value
Initial value
Storage class (in Real-Time Workshop generated code)
Sampling mode (for Truth Table block output data)
For more information, see Resolving Data Properties from Simulink Signal Objects.
Size of the data object. The size can be a scalar value or a MATLAB vector of values. To specify a scalar, set the Size property to 1 or leave it blank. To specify a MATLAB vector, use a multidimensional array, where the number of dimensions equals the length of the vector and the size of each dimension corresponds to the value of each vector element.
The scope of the data object determines what sizes you can specify. Stateflow data store memory inherits all of its properties — including size — from the Simulink data store to which it is bound. For all other scopes, size can be scalar, vector, or a matrix of n-dimensions.
For more information, see Sizing Stateflow Data.
Option that specifies whether or not the data object accepts complex values. You can choose one of these settings:
| Complexity Setting | Description |
|---|---|
| Off | Data object does not accept complex values. |
| On | Data object accepts complex values. |
| Inherited | Data object inherits the complexity setting from a Simulink block. |
For more information, see How Complex Data Works in Stateflow Charts.
Type of data object. You can specify the data type by:
Selecting a built-in type from the Type drop-down list.
Using the Data Type Assistant to specify a data Mode and then specifying the data type based on that mode.
Entering an expression in the Type field that evaluates to a data type.
Note If you enter an expression for a fixed-point data type, you must specify scaling explicitly. For example, you cannot enter an incomplete specification such as fixdt(1,16) in the Type field. If you do not specify scaling explicitly, an error message appears when you try to simulate your model. To ensure that a data type definition is valid for fixed-point data, use one of the two options above. |
For more information, see Typing Stateflow Data.
Properties that apply only to fixed-point data. For a detailed discussion about fixed-point data, see Fixed-Point Concepts in the Simulink Fixed Point User's Guide.
When the Data Type Assistant Mode is Fixed point, the Data Type Assistant displays fields for specifying additional information about your fixed-point data.

If the Scaling is Slope and bias rather than Binary point, the Data Type Assistant displays a Slope field and a Bias field rather than a Fraction length field.

You can use the Data Type Assistant to set these fixed-point properties:
Sign. Specify whether you want the fixed-point data to be Signed or Unsigned. Signed data can represent positive and negative values, but unsigned data represents positive values only. The default setting is Signed.
Word length. Specify the bit size of the word that will hold the quantized integer. Large word sizes represent large values with greater precision than small word sizes. Word length can be any integer between 0 and 32. The default bit size is 16.
Scaling. Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors. The default method is Binary point scaling. You can select one of two scaling modes:
| Scaling Mode | Description |
|---|---|
| Binary point | If you select this mode, the Data Type Assistant displays the Fraction Length field, which specifies the binary point location. Binary points can be positive or negative integers. A positive integer moves the binary point left of the rightmost bit by that amount. For example, an entry of 2 sets the binary point in front of the second bit from the right. A negative integer moves the binary point further right of the rightmost bit by that amount, as in this example:
The default binary point is 0. |
| Slope and bias | If you select this mode, the Data Type Assistant displays fields for entering the Slope and Bias. Slope can be any positive real number, and the default slope is 1.0. Bias can be any real number, and the default bias is 0.0. You can enter slope and bias as expressions that contain parameters you define in the MATLAB workspace. |
Note Use binary-point scaling whenever possible to simplify the implementation of fixed-point data in generated code. Operations with fixed-point data using binary-point scaling are performed with simple bit shifts and eliminate expensive code implementations required for separate slope and bias values. |
For more information about fixed-point scaling, see Scaling in the Simulink Fixed Point User's Guide.
Calculate Best-Precision Scaling. Click this button to calculate "best-precision" values for both Binary point and Slope and bias scaling, based on the Limit range properties you specify in the Value Attributes pane of the Data properties dialog box.
To automatically calculate best precision scaling values:
In the Data properties dialog box, select the Value Attributes tab.
Specify Limit range properties.
Select the General tab.
Select the option Calculate Best-Precision Scaling.
Simulink software calculates the scaling values and displays them in the Fraction Length field or the Slope and Bias fields. For more information, see Constant Scaling for Best Precision in the Simulink Fixed Point User's Guide.
Note The Limit range properties do not apply to Constant and Parameter scopes. For Constant, Simulink software calculates the scaling values based on the Initial value setting. The software cannot calculate best-precision scaling for the Parameter scope. |
Lock output scaling against changes by the autoscaling tool. Check this box to prevent a Simulink model from replacing the current fixed-point type with a type that the autoscaling tool chooses. See Automatic Scaling in the Simulink Fixed Point User's Guide for instructions on autoscaling fixed-point data.
Showing Fixed-Point Details. When you specify a fixed-point data type, you can use the Fixed-point details subpane to see information about the fixed-point data type that is currently defined in the Data Type Assistant. To see the subpane, click the expander next to Fixed-point details in the Data Type Assistant. The Fixed-point details subpane appears at the bottom of the Data Type Assistant.

The rows labeled Minimum and Maximum show the same values that appear in the corresponding Minimum and Maximum fields in the Value Attributes pane of the Data properties dialog box. See Checking Signal Ranges and Checking Parameter Values for more information.
The rows labeled Representable minimum, Representable maximum, and Precision show the minimum value, maximum value, and precision that can be represented by the fixed-point data type currently displayed in the Data Type Assistant. See Fixed-Point Concepts in the Simulink Fixed Point User's Guide for information about these three quantities.
The values displayed by the Fixed-point details subpane do not automatically update if you click Calculate Best-Precision Scaling, or change the range limits, the values that define the fixed-point data type, or anything elsewhere in the model. To update the values shown in the Fixed-point details subpane, click Refresh Details. The Data Type Assistant then updates or recalculates all values and displays the results.
Clicking Refresh Details does not change anything in the model; it changes only the display. Click OK or Apply to put the displayed values into effect. If the value of a field cannot be known without first compiling the model, the Fixed-point details subpane shows the value as Unknown. If any errors occur when you click Refresh Details, the Fixed-point details subpane shows an error flag on the left of the applicable row, and a description of the error on the right. . For example, the next figure shows two errors.

The row labeled Minimum shows the error Cannot evaluate because evaluating the expression MySymbol, specified in the Minimum field of the Value Attributes pane, did not return an appropriate numeric value. When an expression does not evaluate successfully, the Fixed-point details subpane displays the unevaluated expression (truncating to 10 characters if necessary to save space) in place of the unavailable value.
To correct this error, you would need to define MySymbol in an accessible workspace to provide an appropriate numeric value. After you clicked Refresh Details, the value of MySymbol would appear in place of its unevaluated text, and the error indicator and error description would disappear.
To correct the overflow error shown for Maximum, you would need to decrease the value in the Maximum field of the Value Attributes pane, increase Word length, or decrease Fraction length (or perform a combination of these changes) sufficiently to allow the fixed-point data type to represent the maximum value that it could have.
The Value Attributes pane of the Data properties dialog box appears as shown.

You can set these properties in the Value Attributes pane.
Initial value of the data object. If you do not specify a value, the default is 0.0. The options for initializing values depend on the scope of the data object, as follows:
| Scope | What to Specify for Initial Value |
|---|---|
| Local | Expression or parameter defined in the Stateflow hierarchy, MATLAB workspace, or Simulink masked subsystem |
| Constant | Constant value or expression. The expression is evaluated when you update the chart, and the resulting value is used as a constant for running the Stateflow chart. |
| Parameter | You cannot enter a value. The chart inherits the initial value from the parameter. |
| Input | You cannot enter a value. The chart inherits the initial value from the Simulink input signal on the designated port. |
| Output | Expression or parameter defined in the Stateflow hierarchy, MATLAB workspace, or Simulink masked subsystem |
| Data Store Memory | You cannot enter a value. The chart inherits the initial value from the Simulink data store to which it is bound. |
For more information, see Initializing Data from the MATLAB Base Workspace and Sharing Simulink Parameters with Stateflow Charts.
Option that assigns the value of the data item to a variable of the same name in the model workspace at the end of simulation (see Using Model Workspaces in the Simulink software documentation).
Range of acceptable values for this data object. Stateflow software uses this range to validate the data object during simulation. To establish the range, specify these properties:
Maximum — The largest value allowed for the data item during simulation. You can enter an expression or parameter that evaluates to a numeric scalar value.
Minimum — The smallest value allowed for the data item during simulation. You can enter an expression or parameter that evaluates to a numeric scalar value.
The largest value you can set for Maximum is inf, and the smallest value you can set for Minimum is -inf.
Note A Simulink model uses the Limit range properties to calculate best-precision scaling for fixed-point data types. You must specify a maximum or minimum value before you can select the Calculate Best-Precision Scaling option in the General pane. For more information, see Scaling. |
For more information on entering values for Limit range properties, see Entering Expressions and Parameters for Data Properties.
Index of the first element of the data array. The default value is 0.
Units of measurement that you want to associate with the data object. The string in this field resides with the data object in the Stateflow hierarchy.
Option that designates the data object as a test point. Enabling this option guarantees that you can observe the data object during simulation (see Working with Test Points in Simulink software documentation). Data objects can be test points if:
Scope is Local
Parent is not a Stateflow machine
Data type is not ml
Option that enables you to watch the data values in the Stateflow Debugger (see Watching Data in the Stateflow Debugger).
The Description pane of the Data properties dialog box appears as shown.

You can set these properties in the Description pane.
Description of the data object.
Link to online documentation for the data object. You can enter a Web URL address or a MATLAB command that displays documentation in a suitable online format, such as an HTML file or text in the MATLAB Command Window. When you click the Document link hyperlink at the bottom of the properties dialog box, Stateflow software evaluates the link and displays the documentation.
You can enter expressions as values for these properties in the Data properties dialog box:
Minimum and Maximum (see Limit range properties)
Expressions can contain a mix of parameters, constants, arithmetic operators, and calls to MATLAB functions.
When you leave an expression or parameter field blank, Stateflow software assumes a default value, as follows:
| Field | Default |
|---|---|
| Initial value | 0.0 |
| Maximum | inf |
| Minimum | –inf |
| Word length | 16 |
| Slope | 1.0 |
| Bias | 0.0 |
| Binary point | 0 |
| First index | 0 |
| Size |
|
You can include parameters in expressions. A parameter is a constant that you can:
Define in the MATLAB workspace (see Initializing Data from the MATLAB Base Workspace)
Derive from a Simulink block parameter that you define and initialize in the parent masked subsystem (see Sharing Simulink Parameters with Stateflow Charts)
You can mix both types of parameters in an expression.
You can use two types of constants in expressions in the Data properties dialog box:
Numeric constants of the appropriate type and size
Stateflow constants
Stateflow constants are read-only data objects that you add to your chart with the scope Constant (see Adding Data). Stateflow constants retain their initial values, which you set in the Data properties dialog box (see Initial value).
You can use these arithmetic operators in expressions in the Data properties dialog box:
+
–
*
/
In fields that accept expressions, you can call functions that return property values of other variables defined in the Stateflow hierarchy, MATLAB workspace, or Simulink masked subsystem. For example, these functions can return appropriate values for specified fields in the Data properties dialog box:
| Function | Returns | For Field |
|---|---|---|
| MATLAB function size | Size of input array | Size |
| Stateflow function type | Type of input data | Data type |
| MATLAB function min | Smallest element or elements of input array | Minimum |
| MATLAB function max | Largest element or elements of input array | Maximum |
| Simulink function fixdt | Simulink.NumericType object that describes a fixed-point or floating-point data type | Data type |
![]() | Adding Data | Sharing Data with Simulink Models and the MATLAB Workspace | ![]() |
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |