Skip to Main Content Skip to Search
Product 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 new timeseries object by extracting samples from timeseries ts corresponding to the time or times indicated by the subscripted index array, i.

Input Arguments

ts

The timeseries object from which you want to exact samples.

i

A subscripted index array that specifies the time value or values for which you want to extract the corresponding samples.

Output Arguments

ts1

The timeseries object that results from extracting the samples corresponding to the time value or values ts.time(i) .

Examples

After creating a timeseries object, ts, extract the data samples at times 2 and 3 into a new timeseries object, ts1:

ts = timeseries(rand(5,1),[1 2 3 4 5]);
ts1 = getdatasamples(ts, ts.time([2 3]))

See Also

getdatasamples | resample | timeseries

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS