Financial Time Series Toolbox    
sortfts

Sort financial time series

Syntax

Arguments

tsobj
Financial time series object
flag
(Optional) Sort order:
flag = 1; increasing order (default)
flag = -1; decreasing order
seriesnames
(Optional) String containing a data series name or cell array containing a list of data series names

Description

sfts = sortfts(tsobj) sorts the financial time series object tsobj in increasing order based only upon the 'dates' vector if tsobj does not contain time-of-day information. If the object includes time-of-day information, the sort is based upon a combination of the 'dates' and 'times' vectors. The 'times' vector cannot be sorted individually.

sfts = sortfts(tsobj, flag) sets the order of the sort. flag = 1: increasing date and time order. flag = -1: decreasing date and time order.

sfts = sortfts(tsobj, seriesnames, flag) sorts the financial time series object tsobj based upon the data series name(s) seriesnames. The seriesnames argument can be a single string containing a data series name or a cell array containing a list of data series names. If the optional flag is set to -1, the sort is in decreasing order.

[sfts, sidx] = sortfts(...) additionally returns the index of the original object tsobj sorted based on 'dates' or specified data series name(s).

See Also

issorted

sort and sortrows in the MATLAB documentation


  smoothts spctkd