How to work with different amount of datapoints within the .BIN/.log file?

I am trying to do some post analysis on the log files in MATLAB (or Python) as that is required for my thesis. I am using ArduPilog to convert my BIN files to a MATLAB structure, with success. From there, I would like to process the information further (e.g. multiply variables times each other), but MATLAB won’t allow me as my variables have different lengths / amount of data points.

As an example, my ATT.Pitch has 10337 datapoints whereas my GPS.Spd has recorded only 5166. IMU.AccX has 25834.

I am guessing that this is due to different sampling speeds (from different sensors), but am unsure on the proper way to continue. What can I do to match the variables from different sensors in time manually?

I think MAVLogger automatically accounts for this, but again I am asked to use Python or MATLAB.

Thank you!

Kind regards,


You need to put each of your data series onto a common time vector. The easiest way to do this (though maybe not the best, depends on what you’re trying to do) is using a linear interpolation.

COMMON.ATT.Pitch = ATT.Pitch;
COMMON.GPS.Spd = interp1(GPS.TimeS,GPS.Spd,COMMON.TimeS,'linear','extrap');

or something similar to this.


Hi Anderson,

Thank you, this already is insightful. I will consider other interpolation and downsampling methods in addition.