How i can convert from hex numbers to charter ?

1 Ansicht (letzte 30 Tage)
Abduellah Elbakoush
Abduellah Elbakoush am 21 Jan. 2022
Beantwortet: Voss am 21 Jan. 2022
I have hexa numbers array like this
'12'
'A6'
'36'
'36'
'F6'
'04'
'EA'
'F6'
'4E'
'36'
'26'
I want to convert to charecter like this
'Hello world'
can anyone help me to solve this problem ?
  1 Kommentar
DGM
DGM am 21 Jan. 2022
C0 = 'Hello world';
H = ['12'; 'A6'; '36'; '36'; 'F6'; '04'; 'EA'; 'F6'; '4E'; '36'; '26'];
C = char(hex2dec(H)).'
C = '¦66öêöN6&'
C-C0
ans = 1×11
-54 65 -54 -54 135 -28 115 135 -36 -54 -62
C = char(hex2dec(fliplr(H))).'
C = '!jcco@®oäcb'
C-C0
ans = 1×11
-39 5 -9 -9 0 32 55 0 114 -9 -2
It's not immediately apparent how these are encoded, or if they're encoded correctly.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Voss
Voss am 21 Jan. 2022
hexStr = ['12';'A6';'36';'36';'F6';'04';'EA';'F6';'4E';'36';'26'];
char(bin2dec(fliplr(dec2bin(hex2dec(hexStr),8)))).'
ans = 'Hello World'

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by