Stateflow    

Data Dialog Box

The Data dialog box allows you to set the properties of a dialog item.

The dialog box includes the following options.

Name

Name of the data item. 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

Parent of this data item. The parent determines the objects that can access it. Specifically, only the item's parent and descendants of that parent can access the item. You specify the parent of a data item when you add the item to the data dictionary.

Scope

Scope of this data item. A data object's scope specifies where it resides in memory relative to its parent. These are the options for the Scope property:

Local.   A local data object resides and is accessible only in a machine, chart, or state.

Input from Simulink.   This is a data item that is accessible in a Simulink chart block but resides in another Simulink block that may or may not be a chart block. The receiving chart block reads the value of the data item from an input port associated with the data item. See Importing Data for more information.

Output to Simulink.   This is a data item that resides in a chart block and is accessible in another block that may or may not be a chart block. The chart block outputs the value of the datum to an output port associated with the data item. See Defining Output Data for more information.

Temporary.   A temporary data item exists only while its parent is executing. See Defining Temporary Data for more information.

Constant.   A Constant data object is read-only and retains the initial value set in its Data properties dialog box.

Exported.   An exported data item is state machine data that can be accessed by external code that embeds the state machine. See Exporting Data for more information.

Imported.   Imported data is data defined by external code that can be accessed by a state machine embedded in the external code. See Importing Data for more information.

Type

Data type of this data item, e.g., integer, double, etc.

Port

Index of the port associated with this data item (see Associating Ports with Data). This control applies only to input and output data.

Units

Units, e.g., inches, centimeters, etc., represented by this data item. The value of this field is stored with the item in the state machine's data dictionary.

Array

If checked, this data item is an array. Checking this option enables the next two options.

Sizes.   Size of this array. The value of this property may be a scalar or a MATLAB vector. If it is a scalar, it specifies the size of a one-dimensional array (i.e., a vector). If a MATLAB vector, it indicates the size of each dimension of a multidimensional array whose number of dimensions corresponds to the length of the vector.

First Index.   Specifies the index of the first element of this array. For example, the first index of a zero-based array is 0.

Limit Range

This control group specifies values used by the state machine to check the validity of this data item. It includes the next two controls.

Min.   Minimum value that this data item can have during execution or simulation of the state machine.

Max.   Maximum value that this data item can have during execution or simulation of the state machine.

Initialize from

Source of the initial value for this data item: either the Stateflow data dictionary or the MATLAB workspace. If this data item is an array, Stateflow sets each element of the array to the specified initial value.

If the source is the data dictionary, enter the initial value in the adjacent text field. Stateflow stores the value that you enter in the data dictionary.

If the source is the MATLAB workspace, this item gets its initial value from a similarly named variable in the MATLAB workspace of its parent state, chart, or machine. For example, suppose that the name of this item is A and that the parent workspace defines a variable named A. Then at the start of simulation, Stateflow sets the value of this item to the value of A.

Save final value to base workspace

Checking this option causes the value of the data item be assigned to a similarly named variable in the model's base workspace at the end of simulation.

Watch in debugger

If checked, this option causes the debugger to halt if this data item is modified.

Description

Description of this data item.

Document Link

Clicking this field displays user-supplied online documentation for this data item. See Documenting Data for more information.


 Setting Data Properties Defining Data Arrays