FreeMat: DEC2HEX Convert Decimal Number to Hexadecimal

FreeMat

- Main Page
- Related Pages

DEC2HEX Convert Decimal Number to Hexadecimal

Section: Elementary Functions

# Usage

Converts an integer value into its hexadecimal representation. The syntax for its use is

       y = dec2hex(x)

where `x` is an integer (and is promoted to a 64-bit integer if it is not). The returned value `y` is a string containing the hexadecimal representation of that integer. If you require a minimum length for the hexadecimal representation, you can specify an optional second argument

       y = dec2hex(x,n)

where `n` indicates the minimum number of digits in the representation.

# Example

Here are some simple examples:

    --> dec2hex(1023)

    ans =
    3FF

    --> dec2hex(58128493)

    ans =
    376F86D