How can I print 64-bit hex numbers using the SPRINTF function?

16 次查看(过去 30 天)
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

采纳的回答

MathWorks Support Team
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by