Main Content

append

Concatenate timeseries objects in time

Description

example

ts = append(ts1,ts2,…,tsN) creates a new timeseries object by concatenating timeseries objects ts1, ts2, and so on, along the time dimension.

Examples

collapse all

Create two timeseries objects.

ts1 = timeseries(rand(5,1),[1 2 3 4 5],"Name","Series 1")
  timeseries

  Common Properties:
            Name: 'Series 1'
            Time: [5x1 double]
        TimeInfo: tsdata.timemetadata
            Data: [5x1 double]
        DataInfo: tsdata.datametadata
ts2 = timeseries(rand(5,1),[6 7 8 9 10],"Name","Series 2")
  timeseries

  Common Properties:
            Name: 'Series 2'
            Time: [5x1 double]
        TimeInfo: tsdata.timemetadata
            Data: [5x1 double]
        DataInfo: tsdata.datametadata

Append the two timeseries objects by time. The output timeseries object has no name even when the two inputs have names.

ts = append(ts1,ts2)
  timeseries

  Common Properties:
            Name: 'unnamed'
            Time: [10x1 double]
        TimeInfo: tsdata.timemetadata
            Data: [10x1 double]
        DataInfo: tsdata.datametadata

Display the time samples of the result.

ts.Time
ans = 10×1

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10

Input Arguments

collapse all

Input timeseries, specified as a list of scalar timeseries objects to concatenate.

  • The last time sample of an input timeseries must be earlier than or equal to the first time of the following timeseries in the list.

  • The sample size of each input timeseries must be the same.

Data Types: timeseries

Extended Capabilities

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced before R2006a

See Also