Input as the hexadecimal number
조회 수: 22 (최근 30일)
이전 댓글 표시
Is it possible to enter directly the hexadecimal number without the conversion to decimal number and perform all the hexadecimal operation like AND,OR, XOR?
For example a = 0x53656174 , b = 0x454B5350
c = bitand(a,b)
how to represent the hexadecimal number in matlab?
댓글 수: 0
채택된 답변
Guillaume
2016년 8월 11일
편집: Guillaume
2016년 8월 11일
Unfortunately, there is no support for hexadecimal literals. The best you can do is:
a = hex2dec('3656174');
b = hex2dec('454B5350');
However, there is support for displaying in hexadecimal:
format hex
c = bitand(a, b)
댓글 수: 1
Hoa Lu
2021년 11월 30일
Thanks for your tips.
BTW, how about the floating point format such as single (float32), double (float64), or CustomFloat?
추가 답변 (1개)
Stephen23
2022년 4월 26일
Since R2019b it is possible to directly enter literal hexadecimal and binary numeric values:
0x2A
0b101010
댓글 수: 0
참고 항목
카테고리
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!