Convert unsigned integer to decimal
조회 수: 12 (최근 30일)
이전 댓글 표시
I have two unsigned hex values, 9d900000, and 0000, which are suposed to be unsigned intergers: 32 bit and 16 bit, respectively.
I'd like to convert both of these from unsigned int to decimal format. I have this code converting the two to their unsigned format, but I am unsure how to then convert it to decimal. Thanks in advance!
int1 = uint32(9d900000);
int1 = uint16(0000);
댓글 수: 0
답변 (1개)
James Tursa
2021년 12월 7일
편집: James Tursa
2021년 12월 7일
Not sure what the real question is here. Does one of these do what you want?
int1 = uint32(hex2dec('9d900000'));
int1 = uint32(0x9d900000);
You can always convert the result to double if you want.
댓글 수: 1
Steven Lord
2021년 12월 7일
Your second line of code can be simplified.
x1 = 0x9d900000u32
Check:
x2 = uint32(0x9d900000)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!