Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

delsample

Remove sample from timeseries object

Syntax

tsout = delsample(tsin,'Index',timeind)
tsout = delsample(tsin,'Value',timevals)

Description

example

tsout = delsample(tsin,'Index',timeind) deletes the samples in tsin corresponding to the time indices in timeind.

example

tsout = delsample(tsin,'Value',timevals) deletes the samples corresponding to the time values in timevals.

Examples

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 Arguments

collapse all

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

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:

FormatExample
dd-mmm-yyyy HH:MM:SS01-Mar-2000 15:45:17
dd-mmm-yyyy01-Mar-2000
mm/dd/yy03/01/00
mm/dd03/01
HH:MM:SS15:45:17
HH:MM:SS PM3:45:17 PM
HH:MM15:45
HH:MM PM3:45 PM
mmm.dd,yyyy HH:MM:SSMar.01,2000 15:45:17
mmm.dd,yyyyMar.01,2000
mm/dd/yyyy03/01/2000

Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | cell

See Also

|

Introduced before R2006a

Was this topic helpful?