naninterp

One dimensional Interpolation over NaNs.
6,5K téléchargements
Mise à jour 1 déc. 2005

Afficher la licence

One-line logically-indexed call to matlab function "interp1"

Fill nan-holes, fast and easy.

>> x = [1 2 NaN NaN 5 6];
>> naninterp(x)

ans =

1 2 3 4 5 6

Cubic interpolation by default, you should know how to change that :-)

--------------------------------------------------------------------------
function X = naninterp(X)
% Interpolate over NaNs
X(isnan(X)) = interp1(find(~isnan(X)), X(~isnan(X)), find(isnan(X)), 'cubic');
return
--------------------------------------------------------------------------

Citation pour cette source

E. Rodriguez (2026). naninterp (https://fr.mathworks.com/matlabcentral/fileexchange/8225-naninterp), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R13
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur NaNs dans Help Center et MATLAB Answers
Remerciements

A inspiré : interp1gap, repnan

Version Publié le Notes de version
1.0.0.0

added keywords