バージョン (323 KB) 作成者: Chad Greene
Replace NaNs in a 1D array by interpolation

ダウンロード 1.8K 件

更新 2014/11/1


This function replaces NaN values in a 1D array with interpolated or neighboring values. Interpolation schemes assume data are evenly spaced. This function does not extrapolate.

x = repnan(x);
x = repnan(x,method);

x = repnan(x) returns x sans NaNs.

x = repnan(x,method) specifies a method for replacing the original x's NaNs. Methods can be

'linear' (default) performs linear interpolation over missing values in x,
'nearest' performs nearest-neighbor interpolation,
'spline' performs spline interpolation using not-a-knot end conditions,
'pchip' is shape-preserving piecewise cubic interpolation,
'cubic' same as 'pchip',
'v5cubic' cubic convolution via Matlab v5 algorithm
'next' replaces NaN values in x with the next non-NaN value in x,
'previous' replaces NaN values in x with the previous non-NaN value in x,


Chad Greene (2022). repnan (, MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2012b
Windows macOS Linux

ヒントを得たファイル: inpaint_nans, naninterp, Inpaint over missing data in 1-D, 2-D, 3-D,... ND arrays, fillgaps in an array/matrix/image

ヒントを与えたファイル: interp1gap

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!