sccn / xdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

load_xdf.m will not dejitter properly in certain edge-cases

dmedine opened this issue · comments

This line is wrong: https://github.com/xdf-modules/xdf-Matlab/blob/master/load_xdf.m#L530

What can happen is that in the case of a clock reset, the timestamps can go from a very high to a very small range of values. In this case, this line of code will fail to spot the large negative spike in the diff(timestamps) array and the result will be completely wrong. I have a data set where this happens and the effective sampling rate is a negative value. Taking the absolute value of the diff(timestamps) array will stop this from happening.