Converting Hexadecimal values to Ascii Text

조회 수: 60 (최근 30일)
Carolyn Crampton
Carolyn Crampton 2018년 4월 6일
답변: Erdinc Turk 2022년 2월 11일
I am trying to convert a string of hexadecimal values to Ascii text, but I am struggling to find a solution online.
I have split the Hexadecimal values into groups of 2, and then converted into decimal using hex2dec, and now I want to convert each decimal number to Ascii text but cannot find a function in Matlab, or a solution online to do this?
Is there a function in Matlab to convert any hexadecimal value to Ascii text? Should I convert the hexadecimal numbers into binary/octal instead of decimal?
Any help at all would be greatly appreciated, Thanks, Carolyn
  댓글 수: 1
dpb
dpb 2018년 4월 6일
Where is this "string of hexadecimal values"? Almost certainly it already is character; Matlab doesn't have any other native way to display hex data.
Show us, don't just try to describe something; give us code and data to look at; we can't see your terminal from here to know from whence to start.

댓글을 달려면 로그인하십시오.

답변 (2개)

James Tursa
James Tursa 2018년 4월 6일
E.g., using the char( ) function:
>> h = '41'
h =
41
>> d = hex2dec(h)
d =
65
>> c = char(d)
c =
A

Erdinc Turk
Erdinc Turk 2022년 2월 11일
You can convert decimal values to string. Then, there is a way to convert string to ascii using double command. The following link may help you.

카테고리

Help CenterFile Exchange에서 String에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by