Adding Hexadecimal numbers?
이전 댓글 표시
Can someone help me how to add 2 hexadecimal numbers? I would appreciate the help and sentiment.
I tried using: c=dec2hex(hex2dec(a)+hex2dec(b)));
But it didn't work. Is there a correct way to do this?
채택된 답변
추가 답변 (2개)
Steven Lord
2019년 10월 17일
>> 0x3afb + 0x2839
ans =
uint16
25396
>> hex2dec('3afb')+hex2dec('2839')
ans =
25396
Walter Roberson
2019년 10월 17일
1 개 추천
If there is a possibility that the user might enter hex values with more than 53 significant bits then you should use sscanf with %lx format instead of hex2dec.
카테고리
도움말 센터 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!