| Financial Time Series | ![]() |
Concatenate financial time series objects horizontally
Syntax
newfts = horzcat(tsobj1, tsobj2, ...)
Description
horzcat
implements horizontal concatenation of financial time series objects. horzcat essentially merges the data columns of the financial time series objects. All time series objects must have the exact same dates.
When multiple instances of a data series name occur, concatenation adds a suffix to the current names of the data series. The suffix has the format _objectname<n>, where n is a number indicating the position of the time series, from left to right, in the concatenation command. The n part of the suffix appears only when there is more than one instance of a particular data series name.
The description fields will be concatenated as well. They will be separated by //.
Example
Construct three financial time series each containing a data series named DataSeries.
firstfts = fints((today:today+4)', (1:5)','DataSeries','d'); secondfts = fints((today:today+4)', (11:15)','DataSeries','d'); thirdfts = fints((today:today+4)', (21:25)','DataSeries','d');
Concatenate the time series horizontally into a new financial time series newfts.
newfts = [firstfts secondfts thirdfts secondfts];
The resulting object newfts has data series names: DataSeries_firstfts, DataSeries_secondfts2, DataSeries_thirdfts, and DataSeries_secondfts4. Verify this with the command
fieldnames(newfts) ans = 'desc' 'freq' 'dates' 'DataSeries_firstfts' 'DataSeries_secondfts2' 'DataSeries_thirdfts' 'DataSeries_secondfts4'
Use chfield to change the data series names.
See Also
| hist | iscompatible | ![]() |