Main Content

horzcat

Concatenate financial time series objects horizontally

horzcat is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Syntax

horzcat

Description

horzcat implements horizontal concatenation of financial time series objects. horzcat essentially merges the data columns of the financial time series objects. The time series objects must contain the exact same dates and times.

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 are concatenated as well. They are separated by two forward slashes (//).

Examples

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')
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints (line 165) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/display (line 66) 
 
firstfts = 
 
    desc:  (none)
    freq:  Daily (1)

    'dates:  (5)'    'DataSeries:  (5)'
    '02-Oct-2017'    [               1]
    '03-Oct-2017'    [               2]
    '04-Oct-2017'    [               3]
    '05-Oct-2017'    [               4]
    '06-Oct-2017'    [               5]

Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints (line 165) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/display (line 66) 
 
secondfts = 
 
    desc:  (none)
    freq:  Daily (1)

    'dates:  (5)'    'DataSeries:  (5)'
    '02-Oct-2017'    [              11]
    '03-Oct-2017'    [              12]
    '04-Oct-2017'    [              13]
    '05-Oct-2017'    [              14]
    '06-Oct-2017'    [              15]

Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints (line 165) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/display (line 66) 
 
thirdfts = 
 
    desc:  (none)
    freq:  Daily (1)

    'dates:  (5)'    'DataSeries:  (5)'
    '02-Oct-2017'    [              21]
    '03-Oct-2017'    [              22]
    '04-Oct-2017'    [              23]
    '05-Oct-2017'    [              24]
    '06-Oct-2017'    [              25]

Concatenate the time series horizontally into a new financial time series newfts:

newfts  = [firstfts secondfts thirdfts secondfts]
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/horzcat (line 56) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/display (line 66) 
 
newfts = 
 
    desc:   //  //  // 
    freq:  Daily (1)

    'dates:  (5)        '    'DataSeries_firstfts'    'DataSeries_secondft'    'DataSeries_thirdfts'    'DataSeries_secondft'
    '                   '    ':  (5)             '    's2:  (5)           '    ':  (5)             '    's4:  (5)           '
    '02-Oct-2017'            [                  1]    [                 11]    [                 21]    [                 11]
    '03-Oct-2017'            [                  2]    [                 12]    [                 22]    [                 12]
    '04-Oct-2017'            [                  3]    [                 13]    [                 23]    [                 13]
    '05-Oct-2017'            [                  4]    [                 14]    [                 24]    [                 14]
    '06-Oct-2017'            [                  5]    [                 15]    [                 25]    [                 15]

The resulting object newfts has data series names DataSeries_firstfts, DataSeries_secondfts2, DataSeries_thirdfts, and DataSeries_secondfts4.

Verify this with the command

fieldnames(newfts)
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/fieldnames (line 21) 

ans = 
 
     'desc'
     'freq'
     'dates'
     'DataSeries_firstfts'
     'DataSeries_secondfts2'
     'DataSeries_thirdfts'
     'DataSeries_secondfts4'
     'times'

Use chfield to change the data series names.

Note

If all input objects have the same frequency, the new object has that frequency as well. However, if one of the objects concatenated has a different frequency from the others, the frequency indicator of the resulting object is set to Unknown (0).

Version History

Introduced before R2006a