SEREXTRACT

Purpose:

Extracts multiple sections from a series.

Syntax:

SEREXTRACT(series, start, length, offset)

series

-

A series.

start

-

A series. A list of integer starting indices for each section.

length

-

A series. A list of integers specifying the number of points to be extracted for each section. -1 implies extract to the end of the series.

offset

-

Optional. A series, the X offset of the result. Defaults to the X value of the first starting point.

Returns:

A series.

Example:

a = 1..10

b = serextract(a, {1, 2, 3}, {3, 2, -1})

 

b == {1, 2, 3, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10}

 

SEREXTRACT implies:

 

Starting at the first point, extract 3 points.

Starting at the second point, extract 2 points.

Starting at the third point, extract to the end and combine all sections.

Example:

W1: ravel(1..16, 8)

W2: serextract(w1, {{2, 3}, {4, 5}}, {{1, 2}, {3, 5}})

 

W1 == {{1,  9},

       {2, 10},

       {3, 11},

       {4, 12},

       {5, 13},

       {6, 14},

       {7, 15},

       {8, 16}};

 

W2 == 2  11

      4  12

      5  13

      6  14

         15

         16

          0

 

SEREXTRACT implies:

 

Starting at the second point, extract 1 point from column 1.

Starting at the fourth point, extract 3 points from column 1 and combine

 

Starting at the third point, extract 2 points from column 2.

Starting at the fifth point, extract 5 points from column 2 and combine.

Example:

W1: 1..3

W2: serextract(w1, {1, 2, 3}, {-1})

 

W1 == {1, 2, 3}

 

W2 == {1, 2, 3, 2, 3, 3}

 

SEREXTRACT implies:

 

Starting at the first point, extract to the end.

Starting at the second point, extract to the end.

Starting at the third point, extract to the end and combine.

Remarks:

SEREXTRACT is similar to EXTRACT except multiple sections from the same series can be extracted.

 

If start is negative, zeros are prepended to the result. If the number of points to extract is greater than the series or table length, the result is padded with zeros.

 

A value of -1 for length implies extract to the end.

 

If there are fewer start indices than length values or fewer length values than start indices,  the last start or length value is used.

See Also:

COLEXTRACT

CONCAT

CUT

EXTRACT

EXTRACTWIN

RAVEL

XEXTRACT