I'm trying to read a binary data file containing time-series data in Matlab.
Sample data: [23,-10,47,19,-417,-434,-1,29,11,22,23,6,18,13,-383]
Command: fopen(filename,'r','ieee-le');
When I read the data in int8 format and compared to the ground truth, I realized for abs(data)<128, the data is stored in 1 byte, and when abs(data)>128, the data is stored in 2 bytes. And data of either lengths are intermixed together. e.g. for the sample data above, the data I read in int8 would be
[23,-10,47,19,95,-2,78,-2,-1,29,11,22,23,6,18,13,-127,-2]
Without prior knowledge of the true data, I would not have known that I should interpret the two bytes (marked in bold) together as one data point.
The digits in the two-bytes data points can also occur in the one-byte data points, so there's no obvious rule I can separate the two.
Am I reading the data correctly and is there any info I could use to correctly read the data?