Quantcast

Documentation Center

  • Trial Software
  • Product Updates

getsampleusingtime

Class: timeseries

Extract data samples into new timeseries object

Syntax

ts1 = getsampleusingtime(ts, time)
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, starttime, endtime) returns a new timeseries object, ts1, with samples between the times starttime and endtime in ts.

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.

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.

See Also

Was this topic helpful?