Main Content

Specify floating-point, integer, or fixed-point data type

Use a `Simulink.NumericType`

object to set and share numeric
data types for signal, state, and parameter data in a model.

Create an instance of this class in the MATLAB

^{®}base workspace, a model workspace, or a data dictionary. To create a numeric type in a model workspace, you must clear the**Is alias**property.Set the properties of the object to create a custom floating point, integer, or fixed point 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.

To rename a data type in a model and in the code that you generate from a model (by
generating a `typedef`

statement), you can use an object of the class
`Simulink.AliasType`

.

To create a `Simulink.NumericType`

object interactively, use the Model
Explorer:

On the Model Explorer

**Model Hierarchy**pane, select a workspace, such as the base workspace, or a data dictionary.From the Model Explorer

**Add**menu, select**Simulink.NumericType**.The Model Explorer creates an instance of a

`Simulink.NumericType`

object and assigns it to a variable named`Numeric`

in the target workspace.Rename the variable to a more appropriate name, for example, a name that reflects its intended usage.

To change the name, edit the name displayed in the

**Name**field on the Model Explorer**Contents**pane.On the Model Explorer

**Dialog**pane, use the**Data type mode**property to select a data type that the object represents.

To create a `Simulink.NumericType`

object programmatically, use the
`Simulink.NumericType`

function described below.

`typeObj = Simulink.NumericType`

returns a
`Simulink.NumericType`

object with default property
values.

`isboolean` | Determine whether numeric type represents the Boolean data type
`boolean` |

`isdouble` | Determine whether numeric type represents the double-precision, floating-point
data type `double` |

`isfixed` | Determine whether numeric type represents a fixed-point data type |

`isfloat` | Determine whether numeric type represents a floating-point data type |

`isscalingbinarypoint` | Determine whether fixed-point numeric type has binary-point scaling |

`isscalingslopebias` | Determine whether numeric type represents a fixed-point data type with slope-and-bias scaling |

`isscalingunspecified` | Determine whether numeric type represents a data type with unspecified scaling |

`issingle` | Determine whether numeric type represents the single-precision, floating-point
data type `single` |

`ishalf` | Determine whether numeric type represents the half-precision, floating-point data
type `half` |