| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Fixed-Point Toolbox |
| Contents | Index |
| Learn more about Fixed-Point Toolbox |
| On this page… |
|---|
The data properties of a fi object are always writable.
bin — Stored integer value of a fi object in binary
data — Numerical real-world value of a fi object
dec — Stored integer value of a fi object in decimal
double — Real-world value of a fi object, stored as a MATLAB double data type
hex — Stored integer value of a fi object in hexadecimal
int — Stored integer value of a fi object, stored in a built-in MATLAB integer data type. You can also use int8, int16, int32, int64, uint8, uint16, uint32, and uint64 to get the stored integer value of a fi object in these formats
oct — Stored integer value of a fi object in octal
To learn more about these properties, see fi Object Properties in the Fixed-Point Toolbox Reference.
In general, the fimath properties associated with fi objects depend on how you create the fi object:
When you specify one or more fimath object properties in the fi constructor, the resulting fi object has an attached fimath object.
When you do not specify any fimath object properties in the fi constructor, the resulting fi object associates itself with the global fimath. All fi objects created in this way do not have their own attached fimath objects.
To determine whether a fi object has an attached fimath object, use the isfimathlocal function.
The fimath properties associated with fi objects determine how fixed-point arithmetic is performed. These fimath properties can come from an attached fimath object or from the global fimath. To learn more about the relationship between fimath objects and the global fimath in fixed-point arithmetic, see fimath Rules for Fixed-Point Arithmetic.
The following fimath properties are, by transitivity, also properties of the fi object. You can set these properties for individual fi objects or, for multiple fi objects, by configuring the global fimath. The following fimath properties are always writable.
CastBeforeSum — Whether both operands are cast to the sum data type before addition
MaxProductWordLength — Maximum allowable word length for the product data type
MaxSumWordLength — Maximum allowable word length for the sum data type
OverflowMode — Overflow mode
ProductBias — Bias of the product data type
ProductFixedExponent — Fixed exponent of the product data type
ProductFractionLength — Fraction length, in bits, of the product data type
ProductMode — Defines how the product data type is determined
ProductSlope — Slope of the product data type
ProductSlopeAdjustmentFactor — Slope adjustment factor of the product data type
ProductWordLength — Word length, in bits, of the product data type
RoundMode — Rounding mode
SumBias — Bias of the sum data type
SumFixedExponent — Fixed exponent of the sum data type
SumFractionLength — Fraction length, in bits, of the sum data type
SumMode — Defines how the sum data type is determined
SumSlope — Slope of the sum data type
SumSlopeAdjustmentFactor — Slope adjustment factor of the sum data type
SumWordLength — The word length, in bits, of the sum data type
To learn more about these properties, see the fimath Object Properties in the Fixed-Point Toolbox Reference.
To learn more about the global fimath, see Working with the Global fimath.
When you create a fi object, a numerictype object is also automatically created as a property of the fi object:
numerictype — Object containing all the data type information of a fi object, Simulink signal or model parameter
The following numerictype properties are, by transitivity, also properties of a fi object. The following properties of the numerictype object become read only after you create the fi object. However, you can create a copy of a fi object with new values specified for the numerictype properties:
Bias — Bias of a fi object
DataType — Data type category associated with a fi object
DataTypeMode — Data type and scaling mode of a fi object
FixedExponent — Fixed-point exponent associated with a fi object
FractionLength — Fraction length of the stored integer value of a fi object in bits
Scaling — Fixed-point scaling mode of a fi object
Signed — Whether a fi object is signed or unsigned
Signedness — Whether a fi object is signed or unsigned
Slope — Slope associated with a fi object
SlopeAdjustmentFactor — Slope adjustment associated with a fi object
WordLength — Word length of the stored integer value of a fi object in bits
For further details on these properties, see the Property Reference.
There are two ways to specify properties for fi objects in Fixed-Point Toolbox software. Refer to the following sections:
You can set fi object properties in two ways:
Setting the properties when you create the object
Using direct property referencing
You can set properties of fi objects at the time of object creation by including properties after the arguments of the fi constructor function. For example, to set the overflow mode to wrap and the rounding mode to convergent,
a = fi(pi, 'OverflowMode', 'wrap', 'RoundMode', 'convergent')
a =
3.1416
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 16
FractionLength: 13
RoundMode: convergent
OverflowMode: wrap
ProductMode: FullPrecision
MaxProductWordLength: 128
SumMode: FullPrecision
MaxSumWordLength: 128
CastBeforeSum: true
You can reference directly into a property for setting or retrieving fi object property values using MATLAB structure-like referencing. You do so by using a period to index into a property by name.
For example, to get the DataTypeMode of a,
a.DataTypeMode ans = Fixed-point: binary point scaling
To set the OverflowMode of a,
a.OverflowMode = 'wrap'
a =
3.1416
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 16
FractionLength: 13
RoundMode: convergent
OverflowMode: wrap
ProductMode: FullPrecision
MaxProductWordLength: 128
SumMode: FullPrecision
MaxSumWordLength: 128
CastBeforeSum: true
You can also use direct property referencing to associate fi objects with the global fimath. For example, if you have a fi object b with an attached fimath object, you can remove the attached fimath object and force b to associate itself with the global fimath:
b = fi(pi, 1, 'RoundMode', 'Floor')
b =
3.1415
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 16
FractionLength: 13
RoundMode: floor
OverflowMode: saturate
ProductMode: FullPrecision
MaxProductWordLength: 128
SumMode: FullPrecision
MaxSumWordLength: 128
CastBeforeSum: true
b.fimath = []
b =
3.1415
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 16
FractionLength: 13
isfimathlocal(b)
ans =
0
![]() | Casting fi Objects | fi Object Functions | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |