IndexSegments (FPScript)

21.09.2021

Searches for segment beginnings and/or ends in an index data series.

Syntax

IndexSegments(Index, [ Orientation = SEGMENT_BOTH ] [ , MinSize = 2 ])

 

The syntax of the IndexSegments function consists of the following parts:

Part

Description

Index

A data series with ascending indices.

Permitted data structures are data series. All real data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Orientation

Specifies whether to search for segment beginnings, segment ends, or both.

The argument Orientation can have the following values:

Constant

Meaning

SEGMENT_BEGINNINGS

Search for segment beginnings only.

SEGMENT_ENDS

Search for segment ends only.

SEGMENT_BOTH

Search for segment beginnings and ends.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value SEGMENT_BOTH.

MinSize

Specifies the minimum segment size.

Permitted data structures are scalar value. All real data types are permitted.

The value must be greater or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 2.

Remarks

A segment is a continuously ascending sequence of indices. An index is a segment beginning if it does not have a predecessor without gaps. An index is a segment end if it does not have a successor without gaps. Only segments with the minimum number of indices specified with the argument MinSize is output.

If MinSize is equal to 1, then isolated indices are also output. However, these are only output once even though they then represent a segment beginning and a segment end.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

IndexSegments({5, 6, 7, 10, 15, 16})

Results in {5L, 7L, 15L, 16L}. Please note that the 10 is not output because the minimum segment size is 2.

IndexSegments({5, 6, 7, 10, 15, 16}, SEGMENT_BOTH, 1)

Results in {5L, 7L, 10L, 15L, 16L}. In this case the 10 is output, but only once.

ExtractSegments(Signal, IdxSegments(ValuesAboveLevel(Signal, 2)))

Returns a list of signal segments that are above the level of 2.

See Also

ExtractSegments Function

IndexOr Function

IndexAnd Function

IndexNot Function

IndexBefore Function

IndexAfter Function

IndexSort Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles