How i can convert from hex numbers to charter ?

1 visualizzazione (ultimi 30 giorni)
Abduellah Elbakoush
Abduellah Elbakoush il 21 Gen 2022
Risposto: Voss il 21 Gen 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 Commento
DGM
DGM il 21 Gen 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.

Accedi per commentare.

Risposte (1)

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

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by