naninterp

One dimensional Interpolation over NaNs.

Al momento, stai seguendo questo contributo

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
--------------------------------------------------------------------------

Cita come

E. Rodriguez (2026). naninterp (https://it.mathworks.com/matlabcentral/fileexchange/8225-naninterp), MATLAB Central File Exchange. Recuperato .

Riconoscimenti

Ispirato: interp1gap, repnan

Informazioni generali

Compatibilità della release di MATLAB

  • Compatibile con qualsiasi release

Compatibilità della piattaforma

  • Windows
  • macOS
  • Linux
Versione Pubblicato Note della release Action
1.0.0.0

added keywords