| Financial Time Series | ![]() |
Fill missing values in time series
Syntax
newfts = fillts(oldfts, fill_method) newfts = fillts(oldfts, fill_method, newdates) newfts = fillts(oldfts, fill_method, newdates, sortmode)
Arguments
Description
newfts = fillts(oldfts, replaces missing values (represented by fill_method)
NaN) in the financial time series object oldfts with real values, using the interpolation process indicated by fill_method.
newfts = fillts(oldfts, fill_ replaces all the missing values on the specified dates method, newdates)
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 | ![]() |