DEC2HEX Convert Decimal Number to Hexadecimal

Section: Elementary Functions


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.


Here are some simple examples:
--> dec2hex(1023)

ans = 

--> dec2hex(58128493)

ans =