MATLAB: How to print 64-bit hex numbers using the SPRINTF function

dec2hexhexMATLABnum2hexsprintf

I would like to print large 64-bit hex numbers using the SPRINTF function
Executing the SPRINTF function results in the following:
sprintf('%x', 4294967296)
ans =
4.294967e+009
sprintf('%x', 4294967295)
ans =
ffffffff

Best Answer

This enhancement has been incorporated in Release 2010b (R2010b). For previous product releases, read below for any possible workarounds:
The abillity to print 64-bit hex numbers using the SPRINTF function is not available in MATLAB.
To work around this issue, use the following command to print the numbers in hex format:
sprintf('%c', dec2hex(4294967296))
1. This would help you to print out the numbers which are greater than 2^32 in hex format.
2. However, you can only use the range from 0 to 2^52 as the DEC2HEX function gives unpredictable results for nonnegative numbers greater than 2^52. You will get the warning regarding the same in this case.