Main Content

Transformations for Quantized Data

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

Use

  • num2bin to convert data to binary

  • num2hex to convert data to hexadecimal

  • hex2num to convert hexadecimal data to numeric

  • 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 =

  8×3 char array

    '011'
    '010'
    '001'
    '000'
    '111'
    '110'
    '101'
    '100'

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