Class: timeseries

Remove sample from timeseries object


ts1 = delsample(ts,Name,Value)


ts1 = delsample(ts,Name,Value) deletes samples from the timeseries object ts based on the specified Name,Value pair arguments.

Input Arguments


A timeseries object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


The indices of the time vector that correspond to the samples you want to delete.


The time values that correspond to the samples you want to delete.

Output Arguments


The timeseries object that results from removing the specified samples.


Create a timeseries object, and then remove samples:

ts = timeseries(rand(5,1),[10 20 30 40 50]);

% Remove data sample at time index 1

ts1 = delsample(ts,'Index', 1)

% Remove data sample at time value 20:

ts2 = delsample(ts,'Value', [20])

See Also


Introduced before R2006a

Was this topic helpful?