The csv file has content like below, the hexical data is signed 24-bit and has 0x prefix:
I have a few challenges, not quite good with coding with Matlab:
1) How to get rid of 0x prefix?
2) How to convert the signed 24-bit hex to decimal?
I came up with a really ugly code to do the work, but would love to learn a elegant way:
dat = readtable('demo.csv');
dat1 = table2array(dat(:,1));
out = strip(dat1,'left','0');
out = strip(out,'left','x');
out_dec = typecast(uint32(base2dec(out, 16)), 'int32');
if out_dec(i) < 2^23
out_signed(i) = out_dec(i);
out_signed(i) = out_dec(i) - 2^24;