# bin2num

Convert two's complement binary string to number using `quantizer` object

## Syntax

```y = bin2num(q,b) ```

## Description

`y = bin2num(q,b)` uses the properties of `quantizer` object `q` to convert the binary character vector `b` to a numeric array `y`. When `b` is a cell array containing binary representations, `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 binary representations in a column.

## Examples

Create a `quantizer` object and an array of numeric character vectors. Convert the numeric character vectors to binary, then use `bin2num` to convert them back to numeric character vectors.

```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 ```