SplitIntoSegments (FPScript)

21.09.2021

Splits a data set into segments of different lengths and returns them as a list.

Syntax

SplitIntoSegments(Data, Divisions, [ ExcludeBorderSegments = FALSE ] [ , NameTemplate = "%1Segment%2" ])

 

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

Part

Description

Data

The data set to be segmented.

Permitted data structures are data series, data matrix, signal, signal series, signal series with two-dimensional X-component und space curve. All 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.

Divisions

The indices of the positions where one segment ends and the next begins.

Permitted data structures are data series. All numeric 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.

ExcludeBorderSegments

Set this argument to True if the marginal segments before the first and after the last division are not to be included in the result.

Permitted data structures are scalar value. Supported data types are Boolean value.

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

NameTemplate

A template used to form the element names of the segments. Use "%1" to insert the name of the data set to be segmented and "%2" to insert the segment number.

Permitted data structures are scalar value. Supported data types are string.

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

Remarks

The function splits the data set without gaps and assigns the values from Data with the indices listed in Divisions to the next segment. If the next index from Divisions denotes a position that lies before the current index, then this is ignored and the next index from Divisions is read.

The indices are counted starting from zero. Negative indices count from the end, i.e. the index -1 corresponds to the last value in Data, -2 corresponds to the next to last and so on.

If Data is a signal series, then it is segmented in the X direction. In the case of a data matrix, this corresponds to segmentation in the row direction. This corresponds to the index operation Data[][Beginning, End].

Available in

FlexPro Basic, Professional, Developer Suite

Examples

SplitIntoSegments(Signal, LevelCrossings(Signal, 0, 0.1, EVENT_POSITIVE))

Decomposes a vibration signal into individual waves.

Dim Segments = SplitIntoSegments(Signal, LevelCrossings(Signal, 0, 0.1, EVENT_POSITIVE))
XScale(Segments, -Segments.X[0])

Decomposes a vibration signal into individual waves. The X components of the segments are corrected so that they all start with 0.

SplitIntoSegments(Signal, LevelCrossings(Signal, 0, 0.1, EVENT_POSITIVE), False)

Corresponds to the first example, but the partial waves at the beginning and at the end are discarded.

See Also

ExtractSegments Function

XOffsetScale Function

Event Isolation Analysis Object

Data Structures

Index Operator

Share article or send as email:

You might be interested in these articles