| Stateflow User's Guide | ![]() |
Setting General Data Properties
The window tabbed General in the Data dialog has the following appearance.
It includes the property settings described in the following topics.
Name Property
A data name can be of any length and can consist of any alphanumeric and special character combination, with the exception of embedded spaces. The name cannot begin with a numeric character.
Parent Property
You specify the parent of a data item when you add the item to the data dictionary. The parent object for a data determines the objects that can access it. Only the parent of the data and its can access the item. This is a read-only field. Click it to display the parent Stateflow object in the Stateflow diagram editor.
Scope Property
The scope for a data object specifies where it resides in memory relative to its parent. It can be set to one of the following values, depending on its parent:
Local. A local data object can be accessed only by its parent Stateflow object.
Input from Simulink. This is a data parented by a Stateflow diagram. The diagram reads the value of this data from the Simulink model with an input port associated with the data item on the Chart block. See Importing Data from External Stateflow Code for more information.
Output to Simulink. This data is parented by the Stateflow diagram. The diagram sends the value of this data to the Simulink model with an output port associated with the data item on the Chart block. See Sharing Input and Output Data with Simulink for more information.
Temporary. A temporary data object exists only while its parent function (graphical, truth table, embedded MATLAB) is executing. See Defining Temporary Data for more information.
Constant. Constant data is read-only data for its parent Stateflow object and its children. It retains the initial value set in its Data properties dialog box with the Initialize from field in the window tabbed Value Attributes.
Exported. Exported data is data present in the Simulink model that is made available to external code defined in Stateflow. Exporting data enables external code to access this data as well. See Exporting Data to External Stateflow Code for more information.
Imported. Imported data is data parented by the Simulink model that is defined by external code embedded in the Stateflow machine. Importing externally defined data enables the Stateflow machine to access this data as well. See Importing Data from External Stateflow Code for more information.
Input. This scope applies to argument values for a function (graphical, truth table, and embedded MATLAB).
Output. This scope applies to the return value of a function (graphical, truth table, and embedded MATLAB).
Type Property
The type of the data specifies its bit size and how its value is represented. You can select from a list of provided types or enter an expression of type. See Typing Stateflow Data for an explanation on each type of entry.
Fixed-Point Properties
You select an integer base for the fixed-point data in the Stored Integer field. The scaling type for the fixed-point number is entered in the drop-down field below which can take one of the two selectable values, Fraction Length or Scaling. The scaling value is entered in the field to the right. For a detailed description of fixed-point data, see What Is Fixed-Point Data?. See also Specifying Fixed-Point Data in Stateflow.
Stored Integer. Select the integer word type to hold the fixed-point data quantized integer. The size of the word in bits is indicated by a suffix of 8, 16, or 32. Larger word sizes can represent large quantities with greater precision than smaller word sizes. Unsigned types (uint8, uint16, uint32) can represent only positive quantities. Signed types (int8, int16, int32) can represent negative quantities.
Fraction length. Select this value to interpret the entry in the right adjacent field as the binary point location for binary-point-only scaling. A positive integer entry 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 entry moves the binary point further right of the rightmost bit by that amount. Only integers can be entered (see note below).
Scaling. Select this value to interpret the entry in the right adjacent field as scaling with separate slope and bias entered in [Slope Bias] format (can be entered with or without brackets []). For example, the entry [2 3] sets the slope to 2 and the bias to 3. You can also enter the slope or bias as an arithmetic expression, for example, [1.2*2^-2 3.4]. If you enter a single value, it is interpreted as the slope. The value entered for the slope can be any positive real number. The value for the bias can be any real number. See following note.
| Note Values entered for Fraction length or Scaling that exceed the ranges specified in the previous sections are flagged immediately with red text. |
Lock output scaling against changes by the autoscaling tool. Simulink autoscales Stateflow fixed-point data with the Simulink autoscaling tool. Selecting this option prevents Simulink from replacing the current fixed-point type with a Simulink chosen type in the autoscaling tool. See Automatic Scaling" in Fixed-Point Blockset documentation for instructions on autoscaling fixed-point data in Simulink.
Port
Index of the port associated with this data item (see Sharing Input and Output Data with Simulink). This control applies only to input and output data.
Units
Units, for example, inches, centimeters, and so on, represented by this data item. The value of this field is stored with the item in the Stateflow machine's data dictionary.
Size
Size of this data. The value of this property can be a scalar or a MATLAB vector of values. If it is a scalar (for example, 5), it specifies the data as a one-dimensional array (that is, a vector) of that size. If it is a MATLAB vector (for example, [2 3 7]), it specifies the data as a multidimensional array. In this case, the number of dimensions is equal to the length of the vector, and the size of each dimension corresponds to the value of each element of the vector.
The allowed size of the data array that you specify depends on the Scope property of the data, as follows:
* Applies only to Graphical functions and Truth Tables. Embedded MATLAB functions can accept or return only 2-dimensional matrices.
First Index
Specifies the index of the first element of this array. For example, the first element index of a zero-based array is 0.
| Setting Data Properties in the Data Dialog | Setting Value Attribute Data Properties | ![]() |
© 1994-2005 The MathWorks, Inc.