Stateflow.DataType
Data type properties for data and messages
Description
Use a Stateflow.DataType
object to specify the data type
properties for a data object or message.
Creation
Each data object and message has its own Stateflow.DataType
object. To
access the Stateflow.DataType
object, use the Props.Type
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.
Method
— Method for setting data type
"Inherited"
(default) | "Built-in"
| "Bus Object"
| "Enumerated"
| "Expression"
| "Fixed point"
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 Simulink.Bus
object
""
(default) | string scalar | character vector
Name of the Simulink.Bus
object that defines the data object or
message data, specified as a string scalar or character vector. This property applies
only when the Method
property of the data object is "Bus
Object"
. For more information, see Access Bus Signals.
EnumType
— Name of enumerated type
""
(default) | string scalar | character vector
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 the
Method
property of the data object is
"Enumerated"
. For more information, see Reference Values by Name by Using Enumerated Data.
Expression
— Expression that evaluates to data type
""
(default) | string scalar | character vector
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 the
Method
property of the data object is
"Expression"
. For more information, see Specify Data Properties by Using MATLAB Expressions.
Signed
— Signedness
true
or 1 (default) | false
or 0
Signedness, specified as a numeric or logical 1 (true
) or 0
(false
). This property applies only when the
Method
property of the data object is "Fixed
point"
. For more information, see Fixed-Point Data in Stateflow Charts.
WordLength
— Word length
"16"
(default) | string scalar | character vector
Word length, in bits, specified as a string scalar or character vector. This
property applies only when the Method
property of the data object
is "Fixed point"
. For more information, see Fixed-Point Data in Stateflow Charts.
Fixpt
— Fixed-point properties
Stateflow.FixptType
object
Fixed-point properties, specified as a Stateflow.FixptType
object with these properties:
ScalingMode
— Method for scaling the fixed-point data object or message data, specified as"Binary point"
,"Slope and bias"
, or"None"
.FractionLength
— Fraction length, in bits, specified as a string scalar or character vector. This property applies only when theScalingMode
property is"Binary point"
.Slope
— Slope, specified as a string scalar or character vector. This property applies only when theScalingMode
property is"Slope and bias"
.Bias
— Bias, specified as a string scalar or character vector. This property applies only when theScalingMode
property is"Slope and bias"
.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 the Method
property
of the data object is "Fixed point"
. For more information, see Fixed-Point Data in Stateflow Charts.
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)'
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)