| Fixed-Point Toolbox™ | ![]() |
y = bin2num(q,b)
y = bin2num(q,b) uses the properties of quantizer object q to convert binary string b to numeric array y. When b is a cell array containing binary strings, y is a cell array of the same dimension containing numeric arrays. The fixed-point binary representation is two's complement. The floating-point binary representation is in IEEE® Standard 754 style.
bin2num and num2bin are inverses of one another. Note that num2bin always returns the strings in a column.
Create a quantizer object and an array of numeric strings. Convert the numeric strings to binary strings, then use bin2num to convert them back to numeric strings.
q=quantizer([4 3]); [a,b]=range(q); x=(b:-eps(q):a)'; b = num2bin(q,x) b = 0111 0110 0101 0100 0011 0010 0001 0000 1111 1110 1101 1100 1011 1010 1001 1000
bin2num performs the inverse operation of num2bin.
y=bin2num(q,b)
y =
0.8750
0.7500
0.6250
0.5000
0.3750
0.2500
0.1250
0
-0.1250
-0.2500
-0.3750
-0.5000
-0.6250
-0.7500
-0.8750
-1.0000
hex2num, num2bin, num2hex, num2int
![]() | bin | bitand | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |