Remove sample from timeseries object
timeseries
tsout = delsample(tsin,'Index',timeind)
tsout = delsample(tsin,'Value',timevals)
example
tsout = delsample(tsin,'Index',timeind) deletes the samples in tsin corresponding to the time indices in timeind.
tsin
timeind
tsout = delsample(tsin,'Value',timevals) deletes the samples corresponding to the time values in timevals.
timevals
collapse all
Delete a sample in a timeseries object.
Create a timeseries and display its time samples and corresponding data.
tsin = timeseries((0:10:50)',(0:5)'); tsin.Time
ans = 6×1 0 1 2 3 4 5
tsin.Data
ans = 6×1 0 10 20 30 40 50
Delete the last sample by referencing its index, which is 6.
tsout = delsample(tsin,'Index',6); tsout.Time
ans = 5×1 0 1 2 3 4
Alternatively, you can specify the time value 5 to remove the last sample of tsin.
tsout = delsample(tsin,'Value',5);
Input timeseries, specified as a scalar.
Data Types: timeseries
Time indices, specified as a numeric scalar or vector.
Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
double
single
int8
int16
int32
int64
uint8
uint16
uint32
uint64
Sample times, specified as a numeric scalar or vector, or a cell array of date character vectors. Valid date character vectors can have the following forms:
dd-mmm-yyyy HH:MM:SS
01-Mar-2000 15:45:17
dd-mmm-yyyy
01-Mar-2000
mm/dd/yy
03/01/00
mm/dd
03/01
HH:MM:SS
15:45:17
HH:MM:SS PM
3:45:17 PM
HH:MM
15:45
HH:MM PM
3:45 PM
mmm.dd,yyyy HH:MM:SS
Mar.01,2000 15:45:17
mmm.dd,yyyy
Mar.01,2000
mm/dd/yyyy
03/01/2000
Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | cell
cell
set | timeseries
set
You have a modified version of this example. Do you want to open this example with your edits?