Documentation

This is machine translation

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

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

getsampleusingtime

Class: timeseries

Extract data samples into new timeseries object

Syntax

ts1 = getsampleusingtime(ts,time)
ts1 = getsampleusingtime(ts,time,'AllowDuplicateTimes',true)
ts1 = getsampleusingtime(ts,starttime,endtime)

Description

ts1 = getsampleusingtime(ts,time) returns a new timeseries object, ts1, with a single sample corresponding to specified time in ts.

ts1 = getsampleusingtime(ts,time,'AllowDuplicateTimes',true) returns a new timeseries object, ts1, with multiple samples when the specified time occurs more than once in ts.

ts1 = getsampleusingtime(ts,starttime,endtime) returns a new timeseries object, ts1, with samples between the times starttime and endtime in ts.

Input Arguments

ts

The timeseries object from which you want to extract data samples.

time

The time corresponding to data sample you want to extract.

starttime

The time corresponding to the first data sample you want to extract.

endtime

The time corresponding to the last data sample you want to extract.

Output Arguments

ts1

A timeseries object that contains the subset of data samples from the original timeseries object.

Tips

  • If the time vector in ts is not relative to a calendar date, then starttime and endtime must be numeric.

  • If the time vector in ts is relative to a calendar date, then starttime and endtime values must be dates—either strings or datenum values.

See Also

Introduced before R2006a

Was this topic helpful?