Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Simulink.NumericType - Specify data type

Description

This class lets you specify a data type. To do this,

  1. 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.

  2. Set object properties to the properties of the custom data type

  3. 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.

Property Dialog Box

Data type mode

Data type of this numeric type. The options are

Option

Description

Boolean

Same as the MATLAB boolean type.

Double

Same as the MATLAB double type.

Single

Same as the MATLAB single type.

Fixed-point: unspecified scaling

A fixed-point data type with unspecified scaling.

Fixed-point: binary point scaling

A fixed-point data type with binary-point scaling.

Fixed-point: slope and bias scaling

A fixed-point data type with slope and bias scaling.

Selecting a category causes Simulink software to enable controls on the dialog box (see below) that apply to the category and to disable other controls that do not apply. Selecting a fixed-point category may, 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.

Is alias

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 category of the data type as its name, or, if the category is a fixed-point category, Simulink software generates a name that encodes the type's properties, using the encoding specified by the Simulink Fixed Point product.

Header file

Name of a user-supplied C header file that defines a data type having the same name as this numeric type (i.e., as the MATLAB variable that references this object). If this field is not empty, code generated from this model defines the numeric type by including the specified header file. If this field is empty, the generated code defines the numeric type itself.

Description

Description of this data type. This field is intended for use in documenting this data type. Simulink software ignores it.

Signedness

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 categories.

Word-Length

Word length in bits of the fixed-point data type. This option is enabled only for fixed-point data type categories.

Fraction length

Number of bits to the right of the binary point. This option is enabled only if the data type category is Fixed-point: binary point scaling.

Slope

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

Bias

Bias for slope and bias scaling. This option is enabled only if the data type category is Fixed-point: slope and bias scaling. See the preceding figure.

Properties

Name

Access

Description

Bias

RW

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)

DataTypeMode

RW

String that specifies the data type 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)

Description

RW

Description of this data type. (Description)

Fixedexponent

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 data type category 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.

FractionLength

RW

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)

IsAlias

RW

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)

Signedness

RW

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)

Slope

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 Category is Fixed-point: slope and bias scaling. (Slope)

SlopeAdjustmentFactor

RW

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 Category 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.

WordLength

RW

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 Category is Fixed-point. (Word Length)

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS