Simulink.dictionary.archdata.NumericType
Description
Use a Simulink.dictionary.archdata.NumericType
object to
represent a Simulink.NumericType
object in the
Architectural Data section of a data dictionary.
Creation
You can add a Simulink.dictionary.archdata.NumericType
object to a data
dictionary in two ways.
Interactively create a
Simulink.dictionary.archdata.NumericType
object by using the Architectural Data Editor.Programmatically create a
Simulink.dictionary.archdata.NumericType
object by using theaddNumericType
function.
archDataObj = Simulink.dictionary.archdata.create("dataDictionary.sldd"); numeric = addNumericType(archDataObj,"myNumeric")
numeric = NumericType with properties: Name: 'myNumeric' DataTypeMode: 'Double' DataTypeOverride: 'Inherit' IsAlias: 0 Description: '' Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Properties
Bias
— Bias for slope and bias scaling
0
(default) | scalar
Bias for slope and bias scaling of a fixed-point data type (Fixed-Point Designer™), specified as a real number.
If you use a number with a data type other than double
to set
the value, Simulink® converts the value to double
.
This property is accessible only if DataTypeMode
is set to
"Fixed-point: slope and bias scaling"
.
Example: 3
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
DataScope
— Specification to generate or import type definition in generated code
'Auto'
(default) | 'Exported'
| 'Imported'
Specification to generate or import the type definition (typedef
)
in the generated code (Simulink
Coder™), specified as 'Auto'
, 'Exported'
,
or 'Imported'
.
This table shows the effect of each option.
Value | Action |
---|---|
'Auto' (default) | If no value is specified for If a value
is specified for |
'Exported' | Export the data type definition to a header file, which can be specified in
the HeaderFile property. If no value is specified for the
HeaderFile , the header file name defaults to
type .h, where type is
the data type name. |
'Imported' | Import the data type definition from a header file, which can be specified
in the HeaderFile property. If no value is specified for
HeaderFile , the header file name defaults to
type .h, where type is
the data type name. |
Set the data scope to "Imported"
or "Exported"
to avoid potential MISRA C™:2012 violations.
For more information, see Control File Placement of Custom Data Types (Embedded Coder).
DataTypeMode
— Numeric data type
"Double"
(default) | "Boolean"
| "Fixed-point: binary point scaling"
| "Fixed-point: slope and bias scaling"
| "Fixed-point: unspecified scaling"
| "Half"
| "Single"
Data type of the numeric type object, specified as a string scalar or character vector.
"Double"
— Same as the MATLABdouble
type."Single"
— Same as the MATLABsingle
type."Half"
— Half-precision floating-point type."Boolean"
— Same as the MATLABboolean
type."Fixed-point: binary point scaling"
— A fixed-point data type with binary-point scaling that enables propertiesSignedness
,WordLength
, andFractionLength
."Fixed-point: slope and bias scaling"
— A fixed-point data type with slope and bias scaling that enables propertiesBias
,Signedness
,Slope
, andWordLength
."Fixed-point: unspecified scaling"
— A fixed-point data type with unspecified scaling that enables propertiesSignedness
, andWordLength
.
Example: set(numeric,"DataTypeMode","Fixed-point: binary point
scaling");
Data Types: char
| string
DataTypeOverride
— Option to inherit data type
"Inherit"
(default) | "Off"
Option to inherit the data type from another source, specified as either
"Inherit"
or "Off"
.
Example: set(numeric,"DataTypeOverride","Off")
Data Types: char
| string
Description
— Custom description of numeric type
''
(default) | character vector | string
Custom description of the numeric type, specified as a character vector.
Example: 'This numeric type is a double, and inherits its data
type.'
Data Types: char
| string
FractionLength
— Bit length of fractional portion of fixed-point number
0
(default) | integer
Bit length of the fractional portion of a fixed-point number (Fixed-Point Designer), specified as an integer.
If you use a number with a data type other than double
to set the
value, Simulink converts the value to double
.
This property is accessible only if DataTypeMode
is set to
"Fixed-point: binary point scaling"
.
Example: 8
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
HeaderFile
— Name of header file that contains type definition in generated code
''
(default) | character vector | string
Name of the header file that contains the type definition
(typedef
) in the generated code, specified as a character vector.
If this property is specified, the specified name is used during code generation for
importing or exporting. If this property is empty, the value defaults to
if type
.hDataScope
is set to "Imported"
or "Exported"
, or defaults to
if
model
_types.hDataScope
is set to "Auto"
.
By default, the generated #include
directive uses the
preprocessor delimiter "
instead of <
and
>
. To generate the directive #include
<myTypes.h>
, specify HeaderFile
as
'<myTypes.h>'
.
For more information, see Control File Placement of Custom Data Types (Embedded Coder).
Example: '<myHdr.h>'
Example: 'myHdr'
Example: 'myHdr.hpp'
Data Types: char
| string
IsAlias
— Option to specify numeric type as alias
false
or 0
(default) | true
or 1
Option to specify the numeric data type as an alias, specified as a numeric or
logical 1
or true
, or 0
or
false
.
Example: set(numeric,"IsAlias",1)
Data Types: logical
Name
— Name of numeric type
character vector | string scalar
Name of the numeric type object, specified as a character vector or string scalar.
Example:
addNumericType(archDataObj,"myNumericType")
Data Types: char
| string
Owner
— Architectural Data section containing numeric type
Simulink.dictionary.ArchitecturalData
object
Architectural Data section containing the numeric type, specified as a Simulink.dictionary.ArchitecturalData
object.
Example: Owner: [1×1
Simulink.dictionary.ArchitecturalData]
Signedness
— Signedness of fixed-point data type
'Signed'
(default) | 'Unsigned'
| 'Auto'
Signedness of a fixed-point data type (Fixed-Point Designer), specified as 'Signed'
, 'Unsigned'
,
or 'Auto'
(inherit signedness).
This property is accessible only if DataTypeMode
is set to one of
these values:
"Fixed-point: binary point scaling"
"Fixed-point: slope and bias scaling"
"Fixed-point: unspecified scaling"
Data Types: char
Slope
— Slope for slope and bias scaling of fixed-point data type
1
(default) | scalar
Slope for slope and bias scaling of a fixed-point data type (Fixed-Point Designer), specified as a real number.
If you use a number with a data type other than double
to set the
value, Simulink converts the value double
.
This property is accessible only if DataTypeMode
is set to
"Fixed-point: slope and bias scaling"
.
Example: 5.2
Example: 2^9
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
WordLength
— Word size of fixed-point or integer data type
16
(default) | integer
Word size in bits of a fixed-point (Fixed-Point Designer) or integer data type, specified as an integer.
This property is accessible only if DataTypeMode
is set to one of
these values:
"Fixed-point: binary point scaling"
"Fixed-point: slope and bias scaling"
"Fixed-point: unspecified scaling"
Example: 8
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
Object Functions
moveToDictionary | Move architectural data of Simulink data dictionary to another data dictionary |
moveToDesignData | Move interfaces, data types, and constants in Architectural Data section of Simulink data dictionary to design data |
destroy | Delete data element and remove from data interface |
show | View architectural data of Simulink data dictionary in Architectural Data Editor |
Examples
Add Numeric Type to Architectural Data Section of Simulink Data Dictionary
To add a Simulink.NumericType
object with a
specified name to the data dictionary, use the addNumericType
function. For an example that shows more of the workflow for
related functions, see Store Data in Architectural Data Section Programmatically.
Create or open a data dictionary. This example uses a previously created data
dictionary MyInterfaces.sldd
.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
Add numeric types using the addNumericType
function.
myNumericType = addNumericType(archDataObj,"numType")
myNumericType = NumericType with properties: Name: 'numType' DataTypeMode: 'Double' DataTypeOverride: 'Inherit' IsAlias: 0 Description: '' Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Specify the name, and base type using either input arguments of the function or the created numeric type object.
set(myNumericType,"Name","myNumericBinaryPointScale"); set(myNumericType,"DataTypeMode","Fixed-point: binary point scaling");
You can use Simulink.NumericType
objects to define
Simulink.dictionary.archdata.NumericType
objects.
Create a Simulink.NumericType
object referencing a fixed-point data
type.
mySimulinkNum = Simulink.NumericType; mySimulinkNum.DataTypeMode = "Single" mySimulinkNum.Description = "A numeric to be stored as architectural data."
mySimulinkNum = NumericType with properties: DataTypeMode: 'Double' IsAlias: 0 DataScope: 'Auto' HeaderFile: '' Description: ''
Add the Simulink.NumericType
object to the Architectural Data
section of a data dictionary by using the addNumericType
function.
archDataObj = Simulink.dictionary.archdata.open("myDataTypeDict.sldd"); myNumericType = addNumericType(archDataObj,"archDataNum",... "SimulinkNumericType",mySimulinkNum)
myNumericType = NumericType with properties: Name: 'archDataNum' DataTypeMode: 'Single' DataTypeOverride: 'Inherit' IsAlias: 0 Description: 'A numeric to be stored as architectural data.' Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Version History
Introduced in R2023b
See Also
Tools
Objects
Functions
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 (한국어)