WHEREMONO Function

Finds monotone sequences in a one-dimensional array.

Usage

i = WHEREMONO( v, n, s ) 

Input Parameters

v — A vector.

n — A scalar specifying a minimum length for a monotone sequence.

s — A string specifying the type of monotone sequence:

'lt' designates decreasing

'le' designates nonincreasing

'ge' designates nondecreasing

'gt' designates increasing

Returned Value

i — A vector of indices into v: the j'th monotone sequence of length
n is v(i(j):i(j)+n-1); –1 is returned if none exist.

Keywords

None.

Example

a = RANDOMU( s, 20 )  &  PM, a  &  PM, WHEREMONO(a,4,'gt')