Main Content

uint8

Convert fi object to unsigned 8-bit integer

Description

c = uint8(a) returns the built-in uint8 value of fi object a, based on its real world value. If the data does not fit into an uint8, then the data is rounded to nearest and saturated with no warning.

example

Examples

collapse all

a = fi([-pi 0.5 pi],0,8)
a = 
         0    0.5000    3.1406

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 8
        FractionLength: 6
c = uint8(a)
c = 1x3 uint8 row vector

   0   1   3

Input Arguments

collapse all

Input fi object, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: fi
Complex Number Support: Yes

Extended Capabilities

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

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a