File Exchange

image thumbnail


version (188 KB) by Oleg Komarov
Fill consecutive NaNs with last available value


Updated 17 Aug 2015

GitHub view license on GitHub

NANFILLTS Fill NaNs in the time series with the previous valid observation

NANFILLTS(TSPANEL) TSPANEL should be a numeric matrix (or a vector)
where each series is a column with the oldest
observations in the first row (element) and the
most recent ones in the last row (element).

NANFILLTS(..., NOTRAIL) To avoid extrapolation of the last value of a
time series till the end of the panel, set
NOTRAIL to true (1). By default is false (0).

TSPANEL = NANFILLTS(...) Returns the same matrix with filled NaNs.

NOTE: leading NaNs are left untouched.

Cite As

Oleg Komarov (2020). nanfillts (, GitHub. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux