MATLAB: Limits in array size for filtfilt

arrayfiltfiltlimitsMATLAB

just wondering if there is a hard size limit for the filtfilt function? I was looking at a ECG time series collected at 500Hz over several hours, with an array of ~14e7 entries in double. In the process of extracting the QRS complex i first run through a Butterworth bandpass filter, using N = 3, Wn = [5 15]*2/fs in the butter(N,Wn) function. It runs fine up to 6810691 entries, anything over it gives all NaN output. Just wondering have I missed something obvious? I am running on a machine with 16gb ram, i7-4xxx, and during the process it haven't hit the memory/cpu limits. Thank you!
Regards,
Alan
edit: I have included the data file (~55mb)

Best Answer

Use the isnan function to check to be certain that none of the data are NaN:
NaNsum = nnz(isnan(your_signal))
The first NaN will propagate throughout the rest of the filtered signal. If this result is 0, I have no other suggestions or an explanation.
If there are any, use:
NaNidx = find(isnan(your_signal));
to discover their locations.
As a side note, the normal EKG (without arrhythmias) has a spectrum of 0 to 50 Hz, so the passband you’re using will eliminate a significant amount of detail.