Main Content


Maximum of timeseries data



tsmax = max(ts) returns the maximum value of the data samples in a timeseries object.

tsmax = max(ts,Name,Value) specifies additional options when computing the maximum using one or more name-value pair arguments. For example, tsmax = max(ts,'Quality',-99,'MissingData','remove') defines -99 as the missing sample quality code, and removes the missing samples before computing the maximum.


collapse all

Create a timeseries object and compute the maximum data sample.

ts = timeseries((1:5)');
tsmax = max(ts)
tsmax = 5

Input Arguments

collapse all

Input timeseries, specified as a scalar.

Data Types: timeseries

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: tsmax = max(ts,'Quality',-99,'MissingData','remove')

Missing value indicator, specified a scalar, vector, matrix, or multidimensional array of integers ranging from -128 to 127. Each element is a quality code to treat as missing data.

By default, max removes any missing data before computing the maximum. To interpolate the data instead of removing it, specify the name-value pair 'MissingData','interpolation'.

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

Missing data method, specified as either 'remove' to remove missing values before computing the maximum or 'interpolate' to fill missing values by interpolating the data. Specify the 'Quality' name-value pair to indicate which data samples are considered missing.

Version History

Introduced before R2006a

See Also

| |