MATLAB: Convert binary file from hex little endian to decimal

binaryhex

Hi- my first post so go easy.
I get data from a sensor via a RockBlock Iridium Modem. The data come in 50 byte messages. I get an email with the data in Hex (little endian) – here is an example
85cd0a0084a7f6ff884027000b27e5cc0a0031a6f6ff885026000d427acc0a0096a4f6ff886026000c322900605a0002003c
I also get a binary file with the data.
I would like to read the binary file and decode it in matlab. I tried to attach my binary data file but it was not a supported file format so I've included a link to it here
For example, the first 8 bytes correspond to the latitude. I need to convert from little endian to big endian and then to decimal.

Best Answer

So, I think I figured it out.
fname = '300434063383360-608.bin';
fid = fopen(fname);
A = fread(fid);
H = lower(dec2hex(A));
hxstr = [];
for i = 1:length(H)
hxstr = [hxstr H(i,:)];
end
fclose(fid);