I need to convert hexadecimal values into signed decimal values,
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
VIJETH J SHETTY
am 23 Dez. 2021
Kommentiert: VIJETH J SHETTY
am 24 Dez. 2021
- I have a log file(data.log) which contain arrays of(52X1)hexadecimal values.
- Data is saved like this in the log file
F29E031C
F398031C
F3220376
F2220376........
3. first I need to import these values into the matlab
4. Then i need split this 8 charecter cell into 2 rows (like F29E031C = F29E 031C)
5.Finally i need to convert these values into 16bit signed decimal
(for example:
F29E031C = F29E 031C
convetred -3426 796
)
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 23 Dez. 2021
S = 'F29E031C'
typecast(uint16(sscanf(S, '%4x')),'int16')
Except replace the assignment to S with
S = fileread('YourFileName.log');
3 Kommentare
Walter Roberson
am 23 Dez. 2021
S = 'F29E031C F398031C F3220376 F2220376'
i16_values = typecast(uint16(sscanf(S, '%4x')),'int16')
two_columns = reshape(i16_values, 2, []).'
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Event Functions 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!
