# hex2num

Convert hexadecimal string to number using `quantizer` object

## Syntax

``x = hex2num(q,h)``
``[x1,x2,…] = hex2num,(q,h1,h2,…)``

## Description

example

````x = hex2num(q,h)` converts hexadecimal character vector `h` to numeric matrix `x`.The attributes of the numbers in `x` are specified by `quantizer` object `q`. When `h` is a cell array, `hex2num` returns `x` as a cell array of the same dimension containing numbers. For fixed-point hexadecimal representations, `hex2num` uses Two's Complement representation. For floating point, the representation is IEEE® Standard 754 style.When there are fewer hexadecimal digits than needed to represent the number, the fixed-point conversion zero-fills on the left. Floating-point conversion zero-fills on the right.`hex2num` and `num2hex` are inverses of one another, with the distinction that `num2hex` returns the hexadecimal representations in a column. NoteThis function uses a `quantizer` object to convert a hexadecimal string to a number. To convert IEEE hexadecimal format to a double-precision number without using a `quantizer` object, use the MATLAB® `hex2num` function. ```
````[x1,x2,…] = hex2num,(q,h1,h2,…)` converts hexadecimal representations `h1,h2,…` to numeric matrices `x1,x2,…`.```

## Examples

collapse all

This example returns all the 4-bit fixed-point two's complement numbers in fractional form.

```q = quantizer([4 3]); h = ['7 3 F B' '6 2 E A' '5 1 D 9' '4 0 C 8']; x = hex2num(q,h)```
```x = 4×4 0.8750 0.3750 -0.1250 -0.6250 0.7500 0.2500 -0.2500 -0.7500 0.6250 0.1250 -0.3750 -0.8750 0.5000 0 -0.5000 -1.0000 ```

## Input Arguments

collapse all

Input `quantizer` object, specified as a `quantizer` object.

Text representing hexadecimal numbers, specified as a character array.

Data Types: `char`

Text representing hexadecimal numbers, specified as a character array.

Data Types: `char`

## Version History

Introduced before R2006a