Stateflow.DataProps
Data specification properties for data and messages
Description
Use a Stateflow.DataProps
object to specify the data properties
for a data object or message.
Creation
Each data object and message has its own Stateflow.DataProps
object. To
access the Stateflow.DataProps
object, use the Props
property for the Stateflow.Data
or Stateflow.Message
object.
Properties
Stateflow® API objects have properties that correspond to the values you set in the Stateflow
Editor. To access or modify a property, use dot notation. To access or modify multiple
properties for multiple API objects, use the get
and
set
functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.
Type
— Data type properties
Stateflow.DataType
object
Data type properties, specified as a Stateflow.DataType
object with these properties:
Method
— Method for setting the type of the data object or message, specified as a string scalar or character vector.For local, input, output, or parameter data, use
"Inherited"
,"Built-in"
,"Bus Object"
,"Enumerated"
,"Expression"
, or"Fixed point"
.For constant data, use
"Built-in"
,"Expression"
, or"Fixed point"
.For data store memory data, use
"Inherited"
.For messages, use
"Inherited"
,"Built-in"
,"Bus Object"
,"Enumerated"
,"Expression"
, or"Fixed point"
.
This property is equivalent to the Mode field of the Data Type Assistant in the Model Explorer and the Data properties dialog box. For more information, see Specify Scope and Type of Stateflow Data.
BusObject
— Name of theSimulink.Bus
object that defines the data object or message data, specified as a string scalar or character vector. This property applies only when theMethod
property of the data object is"Bus Object"
. For more information, see Access Bus Signals.EnumType
— Name of the enumerated type that defines the data object or message data, specified as a string scalar or character vector. This property applies only when theMethod
property of the data object is"Enumerated"
. For more information, see Reference Values by Name by Using Enumerated Data.Expression
— Expression that evaluates to the data type of the data object or message data, specified as a string scalar or character vector. This property applies only when theMethod
property of the data object is"Expression"
. For more information, see Specify Data Properties by Using MATLAB Expressions.Signed
— Signedness, specified as a numeric or logical 1 (true
) or 0 (false
). This property applies only when theMethod
property of the data object is"Fixed point"
. For more information, see Fixed-Point Data in Stateflow Charts.WordLength
— Word length, in bits, specified as a string scalar or character vector. This property applies only when theMethod
property of the data object is"Fixed point"
. For more information, see Fixed-Point Data in Stateflow Charts.Fixpt.ScalingMode
— Method for scaling the fixed-point data object or message data, specified as"Binary point"
,"Slope and bias"
, or"None"
. This property applies only when theMethod
property of the data object is"Fixed point"
. For more information, see Fixed-Point Data in Stateflow Charts.Fixpt.FractionLength
— Fraction length, in bits, specified as a string scalar or character vector. This property applies only when theMethod
property is"Fixed point"
and theFixpt.ScalingMode
property is"Binary point"
.Fixpt.Slope
— Slope, specified as a string scalar or character vector. This property applies only when theMethod
property is"Fixed point"
and theFixpt.ScalingMode
property is"Slope and bias"
.Fixpt.Bias
— Bias, specified as a string scalar or character vector. This property applies only when theMethod
property is"Fixed point"
and theFixpt.ScalingMode
property is"Slope and bias"
.Fixpt.Lock
— Whether to prevent replacement of the fixed-point type with an autoscaled type chosen by the Fixed-Point Tool (Fixed-Point Designer), specified as a numeric or logical 1 (true
) or 0 (false
). This property applies only when theMethod
property of the data object is"Fixed point"
.
Array
— Array properties
Stateflow.DataArray
object
Array properties, specified as a Stateflow.DataArray
object with these properties:
Size
— Size of the data object or message data, specified as a string scalar or character vector. For more information, see Specify Size of Stateflow Data.IsDynamic
— Whether the data object has variable size, specified as a numeric or logical 1 (true
) or 0 (false
). This property is equivalent to the Variable Size check box in the Property Inspector, the Model Explorer, or the Data properties dialog box. For more information, see Declare Variable-Size Data in Stateflow Charts.FirstIndex
— Index for the first element of the array data object, specified as a string scalar or character vector. This property applies only to array data in charts that use C as the action language. For more information, see Save final value to base workspace.
Complexity
— Whether data object or message accepts complex values
"Off"
(default) | "On"
Whether the data object or message accepts complex values, specified as
"On"
or "Off"
. For more information, see Complex Data in Stateflow Charts.
InitialValue
— Initial value
""
(default) | string scalar | character vector
Initial value, specified as a string scalar or character vector.
Range
— Range of acceptable values
Stateflow.DataRange
object
Range of acceptable values for the data object, specified as a Stateflow.DataRange
object with these properties:
Minimum
— Minimum value, specified as a string scalar or character vector.Maximum
— Maximum value, specified as a string scalar or character vector.
This property does not apply to message data. For more information, see Limit range.
ResolveToSignalObject
— Whether data object resolves to Simulink.Signal
object
false
or 0 (default) | true
or 1
Whether the data object resolves to a Simulink.Signal
object that
you define in the model or base workspace, specified as a numeric or logical 1
(true
) or 0 (false
). This property does not
apply to message data. For more information, see Resolve Data Properties from Simulink Signal Objects.
Unit
— Unit of measurement for input and output data
Stateflow.Unit
object
Unit of measurement for input and output data objects, specified as a Stateflow.Unit
object with this property:
Name
— Name of the unit of measurement, specified as a string scalar or character vector.
This property applies only to input and output data. For more information, see Specify Units for Stateflow Data.
Examples
Specify Fixed-Point Data Type
Access the Stateflow.Props
, Stateflow.DataType
, and Stateflow.FixptType
objects for the Stateflow.Data
object x
.
properties = x.Props; type = properties.Type; fixpt = type.Fixpt;
Specify the fixed-point properties.
type.Method = "Fixed point"; type.Signed = true; type.WordLength = "5"; fixpt.ScalingMode = "Binary point"; fixpt.FractionLength = "2";
Verify the data type.
x.DataType
ans = 'fixdt(1,5,2)'
Specify Size of Data
Access the Stateflow.Props
and
Stateflow.DataArray
objects for the
Stateflow.Data
object x
.
properties = x.Props; array = properties.Array;
Specify the size of the data object.
array.size = "[2 3]";
Specify Range of Values for Data
Access the Stateflow.Props
and
Stateflow.DataRanges
objects for the
Stateflow.Data
object
x
.
properties = x.Props; range = properties.Range;
Specify the minimum and maximum acceptable values.
range.Minimum = "0"; range.Maximum = "1024";
Specify Units for Data
Access the Stateflow.Props
and Stateflow.Unit
objects for the Stateflow.Data
object x
.
properties = x.Props; unit = properties.Unit;
Specify the units as meters.
unit.Name = "m";
Version History
Introduced before R2006a
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)