naninterp

版本 1.0.0.0 (1.1 KB) 作者: E. Rodriguez
One dimensional Interpolation over NaNs.
6.5K 次下载
更新时间 2005/12/1

查看许可证

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

引用格式

E. Rodriguez (2024). naninterp (https://www.mathworks.com/matlabcentral/fileexchange/8225-naninterp), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 NaNs 的更多信息
致谢

启发作品: interp1gap, repnan

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

added keywords