|On this page…|
All properties of a numerictype object are writable. However, the numerictype properties of a fi object become read only after the fi object has been created. Any numerictype properties of a fi object that are unspecified at the time of fi object creation are automatically set to their default values. The properties of a numerictype object are:
Bias associated with the object.
Along with the slope, the bias forms the scaling of a fixed-point number.
Data type category
Data type and scaling associated with the object
Fixed-point exponent associated with the object
Fraction length of the stored integer value, in bits
Scaling mode of the object
Whether the object is signed
Whether the object is signed, unsigned, or has an unspecified sign
Slope associated with the object
Along with the bias, the slope forms the scaling of a fixed-point number.
Slope adjustment associated with the object
The slope adjustment is equivalent to the fractional slope of a fixed-point number.
Word length of the stored integer value, in bits
These properties are described in detail in the fi Object Properties. To learn how to specify properties for numerictype objects in Fixed-Point Designer™ software, refer to Set numerictype Object Properties.
The Slope field of the numerictype object is related to the SlopeAdjustmentFactor and FixedExponent properties by
The FixedExponent and FractionLength properties are related by
If you set the SlopeAdjustmentFactor, FixedExponent, or FractionLength property, the Slope field is modified.
In binary point scaling the numerictype StoredIntegerValue and RealWorldValue properties are related according to
In [Slope Bias] scaling the RealWorldValue can be represented by
which is equivalent to
If any of these properties are updated, the others are modified accordingly.
You can set properties of numerictype objects at the time of object creation by including properties after the arguments of the numerictype constructor function.
For example, to set the word length to 32 bits and the fraction length to 30 bits,
T = numerictype('WordLength', 32, 'FractionLength', 30)
T = DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 30
In addition to creating a numerictype object at the command line, you can also set numerictype properties using the Insert numerictype Constructor dialog box. For an example of this approach, see Example: Build numerictype Object Constructors in a GUI.
You can reference directly into a property for setting or retrieving numerictype object property values using MATLAB structure-like referencing. You do this by using a period to index into a property by name.
For example, to get the word length of T,
ans = 32
To set the fraction length of T,
T.FractionLength = 31
T = DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 31