Financial Time Series    
fillts

Fill missing values in time series

Syntax

Arguments

fill_method
(Optional) Values may be 'linear '(default), 'cubic', 'spline', or 'nearest'.
newdates
(Optional) Column vector of serial dates, a date string, or a column cell array of date strings
sortmode
(Optional) Default = 0 (unsorted). 1 = sorted.

Description

newfts = fillts(oldfts, fill_method) replaces missing values (represented by NaN) in the financial time series object oldfts with real values, using the interpolation process indicated by fill_method.

newfts = fillts(oldfts, fill_method, newdates) replaces all the missing values on the specified dates newdates in the financial time series oldfts with new values through an interpolation process using fill_method. fill_method can be 'linear', 'cubic', 'spline', or 'nearest'. If any of the dates in newdates exist in oldfts, the existing one has precedence. If newdates contains dates outside the boundary of oldfts, the values for those dates will be NaN's.

newfts = fillts(oldts, fillmethod, newdates, sortmode) additionally denotes whether you want the order of the dates in the output object to stay the same as in the input object or to be sorted chronologically.

sortmode = 0 (unsorted) appends any new dates to the end. The interpolation process that calculates the values for the new dates works on a sorted object. Upon completion, the existing dates are reordered as they were originally, and the new dates are appended to the end.

sortmode = 1 sorts the output. After interpolation, no reordering of date sequence occurs.

See Also

interp1 in the MATLAB documentation


 fieldnames filter