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
2010-10-25
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!