| Contents | Index |
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 Local 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, type, initial value, and limit range of a data object. See Properties You Can Set in the General Pane.
Use the Logging pane to enable logging for local data. See Properties You Can Set in the Logging Pane.
Use the Description pane to index into a data object array and enter a description 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 > Show Dialog Pane.
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. For more information, see Rules for Naming Stateflow Objects.
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 Working with Block Masks in Simulink software documentation for information on how to assign a parameter to a masked subsystem. See Sharing Simulink Parameters with 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 MATLAB function. Otherwise, the Simulink model provides the data to the Stateflow chart via an input port on the Stateflow block. See Sharing Output Data with Simulink. |
| Output | Return value of a function if the parent is a graphical, truth table, or MATLAB function. Otherwise, the Stateflow chart provides the data to the Simulink model via an output port on the Stateflow block. See Sharing Output Data with Simulink. |
| 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 Multiple Charts. |
| Temporary | Data that persists only during the execution of a function. You can define temporary data only for a graphical, truth table, or 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 Chart 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 Chart 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 Output Data with Simulink.
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 the 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 the data object changes dimensions during simulation. This check box is available only for input and output data. For more information, see Using Variable-Size Data in Stateflow Charts.
Option that specifies whether 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 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.
Select this check box to prevent replacement of the current data type with a type that the Fixed-Point Tool or Fixed-Point Advisor chooses. See Automatic Scaling Tools in the Simulink Fixed Point User's Guide for instructions on autoscaling fixed-point data.
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 resolves. |
For more information, see Initializing Data from the MATLAB Base Workspace and Sharing Simulink Parameters with Charts.
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:
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.
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.
The smallest value you can set for Minimum is -inf and the largest value you can set for Maximum 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 minimum or maximum value before you can select Calculate Best-Precision Scaling in the General pane. For more information, see Calculate Best-Precision Scaling. |
For more information on entering values for Limit range properties, see Entering Expressions and Parameters for Data Properties.
Option that enables you to watch the data values in the Stateflow Debugger (see Watching Data in the Stateflow Debugger).
Properties that apply 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:
Signedness. 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 holds the quantized integer. Large word sizes represent large values with greater precision than small word sizes. The default bit size is 16.
For chart-level data of the following scopes, word length can be any integer between 0 and 128.
Input
Output
Parameter
Data Store Memory
For other Stateflow data, word length can be any integer between 0 and 32.
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.
Data type override. Specify whether or not to inherit the data type override setting of the Fixed-Point Tool that applies to this model. If the data does not inherit the model-wide setting, the specified data type applies. For more information about the Fixed-Point Tool, see fxptdlg in the Simulink documentation.
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 General tab of the Data properties dialog box.
To automatically calculate best precision scaling values:
In the Data properties dialog box, click the General tab.
Specify Limit range properties.
Click 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 data of Parameter scope. |
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 Limit range section. See 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 Limit range section, cannot return a numeric value. When an expression does not evaluate successfully, the Fixed-point details subpane shows the unevaluated expression (truncating to 10 characters as needed) in place of the unavailable value.
To correct this error, define MySymbol in the base workspace to provide a numeric value. If you click Refresh Details, the value of MySymbol appears in place of the unevaluated text, and the error indicator and description disappear.
To correct the overflow error for Maximum, perform one or more of the following changes so that the fixed-point data type can represent the maximum value you specify:
Decrease the value in the Maximum field of the Limit range section.
Increase Word length.
Decrease Fraction length.
The Logging pane of the Data properties dialog box appears as shown.

You can set these properties in the Logging pane.
Saves the data value to the MATLAB workspace during simulation.
Designates the data as a test point. A test point is a signal you can observe in a Floating Scope block in a model (see Working with Test Points in the Simulink documentation). Data objects can be test points if:
Scope is Local
Parent is not a Stateflow machine
Data type is not ml
Specifies the name associated with logged signal data. Simulink software uses the signal name as its logging name by default. To specify a custom logging name, select Custom from the list box and enter the new name in the adjacent edit field.
Limits the amount of data logged to the most recent samples.
Limits the amount of data logged by skipping samples. For example, a decimation factor of 2 saves every other sample.
The Description pane of the Data properties dialog box appears as shown.

You can set these properties in the Description pane.
Option that assigns the value of the data item to a variable of the same name in the base workspace at the end of simulation (see Using Model Workspaces in the Simulink documentation).
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.
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 Charts)
You can mix both types of parameters in an expression.
For expressions in the Data properties dialog box, you can use numeric constants of the appropriate type and size. Do not use Stateflow constants in these expressions.
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 |
|---|---|---|
| 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 Inputs, Outputs, and Parameters with Simulink and the MATLAB Workspace | ![]() |

Learn how engineers use Stateflow to model state machines in their Simulink models.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |