Negitive number from a hex value

21 次查看(过去 30 天)
If I go into the windows calculator and type in -69 in decimal and I convert that to hex I get FFFFFFBB. If I go into MatLab and I type int32(hex2dec('FFFFFFBB')) I get 2147483647. Is there any way that I can take a hex value and get the negative representation of the value, so I’d like FFFFFFBB in MatLab to give me -69. Thanks!
  1 个评论
Duke
Duke 2014-2-4
Anyone know anything about this, or understand what I'm asking?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2014-2-4
typecast(uint32(hex2dec('FFFFFFBB')),'int32')

更多回答(1 个)

Thomas
Thomas 2014-2-4
编辑:Thomas 2014-2-4
2147483647 is Maximum integer value in matlab
you can get that by typing
intmax
so the answer you are getting is not value out of hex2dec but the intmax.
You can use Two's complement to represent negative numbers.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by