setuniformtime

Modify uniform timeseries time vector

Syntax

tsout = setuniformtime(tsin,'StartTime',starttime)
tsout = setuniformtime(tsin,'Interval',interval)
tsout = setuniformtime(tsin,'EndTime',endtime)
tsout = setuniformtime(tsin,'StartTime',starttime,'Interval',interval)
tsout = setuniformtime(tsin,'StartTime',starttime,'EndTime',endtime)
tsout = setuniformtime(tsin,'Interval',interval,'EndTime',endtime)

Description

tsout = setuniformtime(tsin,'StartTime',starttime) returns a timeseries object with a modified uniform time vector determined from starttime. The end time is given by starttime+(length(tsin)-1). The unit of time is unchanged.

tsout = setuniformtime(tsin,'Interval',interval) sets the start time to 0 and defines the end time as (length(tsin)-1)*interval.

tsout = setuniformtime(tsin,'EndTime',endtime) sets the start time to 0 and defines the interval as endtime/(length(tsin)-1).

tsout = setuniformtime(tsin,'StartTime',starttime,'Interval',interval) defines the end time as starttime+(length(tsin)-1)*interval.

example

tsout = setuniformtime(tsin,'StartTime',starttime,'EndTime',endtime)defines the interval as (endtime-starttime)/(length(tsin)-1).

tsout = setuniformtime(tsin,'Interval',interval,'EndTime',endtime) defines the start time as endtime-(length(tsin)-1)*interval.

Examples

collapse all

Create a timeseries object with a uniform time vector.

tsin = timeseries((1:5)',1:5);
tsin.Time
ans = 5×1

     1
     2
     3
     4
     5

Modify the time vector by specifying a new start time and end time.

tsout = setuniformtime(tsin,'StartTime',10,'EndTime',20);
tsout.Time
ans = 5×1

   10.0000
   12.5000
   15.0000
   17.5000
   20.0000

Input Arguments

collapse all

Input timeseries, specified as a scalar.

Data Types: timeseries

Start time of the uniform time vector, specified as a numeric scalar.

Interval of the uniform time vector, specified as a numeric scalar.

End time of the uniform time vector, specified as a numeric scalar.

See Also

Introduced before R2006a