| Contents | Index |
This class lets you specify a data type as follows:
Create an instance of this class in the MATLAB base workspace or a model workspace. To create a numeric type in a model workspace, you must disable the Is alias option.
Set object properties to the properties of the custom data type.
Assign the data type to all signals and parameters of your model that you want to conform to the data type.
Assigning a data type in this way allows you to change the data types of the signals and parameters in your model by changing the properties of the object that describe them. You do not have to change the model itself.

Data type of this numeric type. The options are
Option | Description |
|---|---|
Same as the MATLAB boolean type. | |
Same as the MATLAB double type. | |
Same as the MATLAB single type. | |
A fixed-point data type with unspecified scaling. | |
A fixed-point data type with binary-point scaling. | |
A fixed-point data type with slope and bias scaling. |
Selecting a data type mode causes Simulink software to enable controls on the dialog box (see below) that apply to the mode and to disable other controls that do not apply. Selecting a fixed-point data type mode might, depending on the other dialog box options that you select, cause the model to run only on systems that have a Simulink Fixed Point option installed.
Data type override setting for this numeric type. The options are
Option | Description |
|---|---|
Inherit (default) | Data type override setting for the context in which this numeric type is used (block, signal, Stateflow chart in Simulink) applies to this numeric type. |
Off | Data type override setting does not affect this numeric type. |
If this option is selected for a workspace object of this type, Simulink software uses the name of the object as the data type for all objects that specify the object as its data type. Otherwise, Simulink software uses the data type mode of the data type as its name, or, if the data type mode is a fixed-point mode, Simulink software generates a name that encodes the type's properties, using the encoding specified by the Simulink Fixed Point product.
Specifies whether the data type definition should be imported from, or exported to, a header file during code generation. The possible values are:
| Value | Action |
|---|---|
| Auto (default) | If no value is specified for Header file,
export the type definition to model_types.h,
where model is the model
name. If a value is specified for Header file, import the data type definition from the specified header file. |
| Exported | Export the data type definition to a header file, which can be specified in the Header file field. If no value is specified for Header file, the header file name defaults to type.h, wheretype is the data type name. |
| Imported | Import the data type definition from a header file, which can be specified in the Header file field. If no value is specified for Header file, the header file name defaults to type.h, wheretype is the data type name. |
Name of a C header file from which a data type definition is imported, or to which a data type definition is exported, based on the value of Data scope. If this field is specified, the specified name is used during code generation for importing or exporting. If this field is empty, the value defaults to type.h if Data scope equals Imported or Exported, or defaults to model_types.h if Data scope equals Auto.
Description of this data type. This field is intended for use in documenting this data type. Simulink software ignores it.
Specifies whether the data type is signed or unsigned, or inherits its signedness. Set the option to Signed, Unsigned, or Auto. This option is enabled only for fixed-point data type modes.

Word length in bits of the fixed-point data type. This option is enabled only for fixed-point data type modes.
Number of bits to the right of the binary point. This option is enabled only if the data type mode is Fixed-point: binary point scaling.

Slope for slope and bias scaling. This option is enabled only if the data type mode is Fixed-point: slope and bias scaling.

Bias for slope and bias scaling. This option is enabled only if the data type mode is Fixed-point: slope and bias scaling. See the preceding figure.
Name | Access | Description |
|---|---|---|
Bias used for slope and bias scaling of a fixed-point data type. This field is intended for use by the Simulink Fixed Point product. (Bias) | ||
DataScope | RW | A string specifying whether the data type definition should be imported from, or exported to, a header file during code generation. (Data scope) |
String that specifies the data type mode of this numeric type. Valid values are 'Double', 'Boolean', 'Single', 'Fixed-point: unspecified scaling', 'Fixed-point: binary point scaling', and 'Fixed-point: slope and bias scaling'. (Data type mode) | ||
DataTypeOverride | RW | String that specifies the data type override mode. Valid values are Inherit and Off. (Data type override) |
Description of this data type. (Description) | ||
| RW | Exponent used for binary point scaling. This property equals -FractionLength. Setting this property causes Simulink software to set the FractionLength and Slope properties accordingly, and vice versa. This property applies only if the DataTypeMode is Fixed-point: binary point scaling or Fixed-point: slope and bias scaling. It does not appear on the object's Property dialog box, but can be accessed from the MATLAB command prompt. | |
Integer that specifies the size in bits of the fractional portion of the fixed-point number. This property equals -Fixedexponent. Setting this property causes Simulink software to set the Fixedexponent property accordingly, and vice versa. This field is intended for use by the Simulink Fixed Point product. (Fraction length) | ||
| RW | A string that specifies the name of a C header file from which a data type definition is imported, or to which a data type definition is exported, during code generation. (Header file) | |
Integer that specifies whether to use the name of this object as the name of the data type that it specifies. Valid values are 1 (yes) or 0 (no). (Is alias) | ||
Boolean that specifies whether this data type is signed, unsigned, or inherits its signedness. Valid values are 1 (signed), 0 (unsigned), or Auto (inherit signedness). (Signedness) | ||
| RW | Slope for slope and bias scaling of fixed-point numbers. This property equals SlopeAdjustmentFactor * 2^Fixedexponent. If SlopeAdjustmentFactor is 1.0, Simulink software displays the value of this field as 2^SlopeAdjustmentFactor. Otherwise, it displays it as a numeric value. Setting this property causes Simulink software to set the Fixedexponent and SlopeAdjustmentFactor properties accordingly, and vice versa. This property appears only if DataTypeMode is Fixed-point: slope and bias scaling. (Slope) | |
Slope for slope and bias scaling of fixed-point numbers. Setting this property causes Simulink software to adjust the Slope property accordingly, and vice versa. This property applies only if DataTypeMode is Fixed-point: slope and bias scaling. It does not appear on the object's Property dialog box, but can be accessed from the MATLAB command prompt. | ||
Integer that specifies the word size of this data type. This field is intended for use by the Simulink Fixed Point product. This property appears only if DataTypeMode is Fixed-point. (Word Length) |
| Name | Description |
|---|---|
isboolean | Determine whether data type is Boolean Returns 1 when the DataTypeMode is 'Boolean', 0 otherwise. |
isdouble | Determine whether data type is double precision Returns 1 when the DataTypeMode is 'Double', 0 otherwise. |
isfixed | Determine whether data type is fixed point Returns 1 when the DataTypeMode is any of the fixed-point options, 0 otherwise. The fixed-point options are:
|
isfloat | Determine whether data type is floating point Returns 1 when the DataTypeMode is 'Double' or 'Single', 0 otherwise. |
isscalingbinarypoint | Determine whether data type has binary point scaling Returns 1 when the data type has binary point scaling or trivial slope and bias scaling, 0 otherwise. Slope and bias scaling is trivial when the slope is an integer power of two and the bias is zero. DataTypeMode is 'Fixed-point: binary point scaling' |
isscalingslopebias | Determine whether data type has nontrivial slope and bias scaling Returns 1 when the data type has nontrivial slope and bias scaling, 0 otherwise. Slope and bias scaling is trivial when the slope is an integer power of two and the bias is zero. DataTypeMode is 'Fixed-point: slope and bias scaling' |
isscalingunspecified | Determine whether data type has unspecified scaling Returns 1 when the data type is fixed point and its scaling has not been specified, 0 otherwise. DataTypeMode is 'Fixed-point: unspecified scaling' |
issingle | Determine whether data type is single-precision Returns 1 when the DataTypeMode is 'Single', 0 otherwise. |
Code Generation with User-Defined Data Types in the Embedded Coder documentation

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |