Help converting hex string to multiple decimal numbers

I'm trying to parse a data file and convert hex strings into various numerical types. I have data that was correctly parsed using a c program I'm trying to implement in MatLab and I have a sample string and corresponding decimal values.
I have a method that works but I'm wondering if someone could give me a better solution.
My code is below. It correctly parses the hex string into 3 decimal values plus a trailing zero.
Obviously I can delete the final zero but I'd like a more elegant solution that yields only the 3 values.
Any help would be appreciated.
str = '9e2d76007202';
typecast(swapbytes(hex2num(str)),'int16')
ans =
1×4 int16 row vector
11678 118 626 0

Respuestas (0)

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Preguntada:

el 8 de Feb. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by