DADiSP Worksheet Functions > A - E > COLEXTRACT

 

COLEXTRACT

Purpose:

Extracts a portion of each column of a table.

Syntax:

COLEXTRACT(a, start, length, offset)

a

-

A table.

start

-

A series. A list of integer starting points.

length

-

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

offset

-

Optional. A series. A list of real values specifying the X offset of the resulting columns. Defaults to the X value of the starting points.

Returns:

A table.

Example:

a = {{1, 2, 3},

     {4, 5, 6}, 

     {7, 8, 9}, 

     {3, 4, 5}} 

 

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

 

b == {{1, 5, 9},

      {4, 8, 5}, 

      {7}} 

 

Here COLEXTRACT implies the following:

 

Starting at the first point, extract 3 points from column 1.

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

Starting at the third point, extract to the end of column 3.

Example:

W1: integ(gnorm(100,1))

W2: integ(gnorm(200, .1))

W3: ravel(W1, W2)

W4: colmaxidx(W3)’

W5: colextract(W3, W4-10, ones(numcols(W3), 1)*20+1)

W6: W1;overp(col(w5, 1), lred)

W7: W2;overp(col(W5, 2), lred)

 

image\colextrpic.gif

 

W6 and W7 highlight in light red a 20 point window around the maximum values of the original series in W1 and W2.

Remarks:

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.

See Also:

CONCAT

CUT

EXTRACT

EXTRACTWIN

RAVEL

SEREXTRACT

XEXTRACT