Documentation

getsamples

Class:timeseries

Subset of time series samples using subscripted index array

Syntax

ts1 = getsamples(ts, i)

Description

ts1= getsamples(ts, i)returns a newtimeseriesobject by extracting samples fromtimeseriestscorresponding to the time or times indicated by the subscripted index array,i.

Input Arguments

ts

Thetimeseriesobject from which you want to extract samples.

i

An index array corresponding to the times to extract.

Output Arguments

ts1

Thetimeseriesobject that results from extracting the samples corresponding to the time value or valuests.time(i).

Examples

After creating atimeseriesobject,ts, extract the data samples at times 2 and 3 into a newtimeseriesobject,ts1:

ts = timeseries(rand(5,1),[1 2 3 4 5]); ts1 = getsamples(ts, ts.time([2 3]))
Was this topic helpful?