Main Content

getsamples

Subset of timeseries

Description

example

tsout = getsamples(tsin,ind) returns a timeseries object that is a subset of the input timeseries. The samples in tsout are the samples of tsin corresponding to tsin.Time(ind).

Examples

collapse all

Create a timeseries object tsout that is a subset of the samples in the timeseries object tsin.

tsin = timeseries([10 20 30 40 50]',[1 2 3 4 5]);
tsout = getsamples(tsin, tsin.time([2 3]));
tsout.Data
ans = 2×1

    20
    30

Input Arguments

collapse all

Input timeseries, specified as a scalar.

Data Types: timeseries

Row or column indices, specified as a positive integer numeric scalar or vector. ind represents column indices for column-oriented data (ts.IsTimeFirst is true) and represents row indices for row-oriented data (ts.IsTimeFirst is false).

Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Version History

Introduced before R2006a