This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Class: timeseries

Subset of time series samples using subscripted index array


ts1 = getsamples(ts, i)


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


The timeseries object from which you want to extract samples.


An index array corresponding to the times to extract.

Output Arguments


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


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 = getsamples(ts, ts.time([2 3]))
Was this topic helpful?