dec2hex
Convert decimal number to base 16.
📝Syntax
R = dec2hex(D)
R = dec2hex(D, N)
📥Input Arguments
Parameter Description
D a non negative integer smaller than the value returned by flintmax, or a negative value of a signed integer class (int8, int16, int32, int64).
N an integer value. number of digits.
📤Output Arguments
Parameter Description
R result of dec2hex: char array.
📄Description

dec2hex converts decimal number to base 16.

A negative value of a signed integer class is converted using the two's complement representation over the native bit width of the type (8, 16, 32 or 64 bits), so dec2hex(int8(-1)) returns 'FF'.

💡Examples
Y = dec2hex(12)
Y = dec2hex(int8(-92))
🔗See Also
dec2basehex2dec
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub