Cubic spline interpolation in interp1 doesn't remove NaN
Mostra commenti meno recenti
I have functional near-infrared spectroscopy timeseries data which sometimes contain NaNs and/or infinite values in some channels.
Baed on literature, spline interpolation seems to be the method of choice to replace these.
I use interp1 as follows:
Y.hbo(isnan(Y.hbo)) = interp1(find(~isnan(Y.hbo)), Y.hbo(~isnan(Y.hbo)), find(isnan(Y.hbo)), 'spline');
Y ist the structure containing the different hemoglobine signals, with rows indicating sample points and columns containing channels'data. (I attached the mat file.)
NaNs are replaced, e.g., with method 'nearest', 'linear', or 'pchip'. Only 'spline' doesn't replace any NaN.
Any idea what is going wrong?
2 Commenti
Mathieu NOE
il 10 Giu 2021
hello
which matlab release are you using
I do remember that in older versions, interp1 with spline method was not able to cope with NaN values
that may have been changed as my doc of R2020b does not speak about this limitation;
BB
il 10 Giu 2021
Risposta accettata
Più risposte (1)
Steven Lord
il 10 Giu 2021
0 voti
The fillmissing function offers several methods to use in filling in the missing data (NaN in the case of your numeric data.) One of those options is 'spline'.
Categorie
Scopri di più su Spline Postprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!