Main Content

Transformations for Quantized Data

You can convert data values from numeric to hexadecimal or binary according to the specifications of a quantizer object.

  • Use num2bin to convert data to binary

  • Use num2hex to convert data to hexadecimal

  • Use hex2num to convert hexadecimal data to numeric

  • Use bin2num to convert binary data to numeric

For example,

q = quantizer([3 2]);
x = [0.75   -0.25
     0.50   -0.50
     0.25   -0.75
        0      -1 ];
b = num2bin(q,x)
b = 8x3 char array
    '011'
    '010'
    '001'
    '000'
    '111'
    '110'
    '101'
    '100'

produces all two's complement fractional representations of 3-bit fixed-point numbers.

See Also

| | |