delsample
Removes samples from a timeseries object.
Category: Language Fundamentals > Data Types
Syntax
ts2 = delsample(ts, 'Index', n)
Removes the samples at the indices n.
ts2 = delsample(ts, 'Value', t)
Removes the samples at the time values t.
Description
The time vector and the data are shortened together, so the remaining samples keep their original times; no interpolation takes place. Use 'Index' when you know the position and 'Value' when you know the time.
Input arguments
ts- timeseries object.
n- Sample indices.
t- Time values.
Output arguments
ts2- timeseries with the samples removed, in both
TimeandData.
Example
By index and by time
ts = timeseries([1 2 3 4]', [0 1 2 3]');
a = delsample(ts, 'Index', [2 3]);
a.Time'
a.Data'
b = delsample(ts, 'Value', 2);
b.Time'
Output
ans = 1×2
0 3
ans = 1×2
1 4
ans = 1×3
0 1 3