Main Content


Stored integer value of fi object



x = storedInteger(a) returns the stored integer value of fi object a.

Fixed-point numbers can be represented as

real-world value=2fraction length×stored integer

or, equivalently as

real-world value=(slope×stored integer)+bias

The stored integer is the raw binary number, in which the binary point is assumed to be at the far right of the word.


collapse all

This example shows how to find the stored integer values for two fi objects. Use the class function to display the stored integer data types.

x = fi([0.2 0.3 0.5 0.3 0.2]);
in_x = storedInteger(x);
c1 = class(in_x)
c1 = 
numtp = numerictype('WordLength',17);
x_n = fi([0.2 0.3 0.5 0.3 0.2],'numerictype',numtp);
in_xn = storedInteger(x_n);
c2 = class(in_xn)
c2 = 

Input Arguments

collapse all

Fixed-point numeric object from which you want to get the stored integer value, specified as a fi object.

Data Types: fi
Complex Number Support: Yes

Output Arguments

collapse all

Stored integer value of fi object, returned as an integer.

The returned stored integer value is the smallest built-in integer data type in which the stored integer value f fits. Signed fi values return stored integers of type int8, int16, int32, or int64. Unsigned fi values return stored integers of type uint8, uint16, uint32, or uint64. The return type is determined based on the stored integer word length (WL):

  • WL ≤ 8 bits, the return type is int8 or uint8.

  • 8 bits < WL ≤ 16 bits, the return type is int16 or uint16.

  • 16 bits < WL ≤ 32 bits, the return type is int32 or uint32.

  • 32 bits < WL ≤ 64 bits, the return type is int64 or uint64.


When the word length is greater than 64 bits, the storedInteger function errors. For bit-true integer representation of very large word lengths, use bin, oct, dec, hex, or sdec.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2012a