GETCOLUMN

Purpose:

Extracts multiple columns from a table.

Syntax:

GETCOLUMN(a, columns)

a

-

A series or table.

columns

-

A series. The column indices to extract.

Returns:

A series.

Example:

W1: {{1, 4, 6},

     {2, 5, 7}, 

     {3, 6, 8}} 

 

W2: getcolumn(W1, {2})

 

W2 == {4, 5, 6}

 

W2 contains the 2nd column of W1.

Example:

W3: {{1, 4, 6},

     {2, 5, 7}, 

     {3, 6, 8}} 

 

W4: W3[.., 2]

 

W4 == {4, 5, 6}

 

Same as above, except array indexing is used to obtain the 2nd column.

Example:

W1: {{1, 4, 6},

     {2, 5, 7}, 

     {3, 6, 8}} 

 

W2: getcolumn(w1, {1, 2, 1})

 

W2 == {{1, 4, 1},

       {2, 5, 2}, 

       {3, 6, 3}} 

 

W2 contains the 1st, 2nd and 1st columns of W1.

Example:

W3: {{1, 4, 6},

     {2, 5, 7}, 

     {3, 6, 8}} 

 

W4: w1[.., {1, 2, 1}]

 

W4 == {{1, 4, 1},

       {2, 5, 2}, 

       {3, 6, 3}} 

 

Same as above, except array indexing is used to obtain the columns.

Remarks:

GETCOLUMN is similar to COL except a series of indices are specified to extract multiple columns in any order.

 

GETCOLUMN can be abbreviated as GETCOL.

 

See GETROW to extract multiple rows from an array.

 

See .. (Range Specifier) for more example of the array syntax method for extracting one or more rows and/or columns.

See Also:

{} Array Construction

.. (Range Specifier)

COL

COLEXTRACT

COLLENGTH

COLPAIRWISE

GETITEM

GETROW

NUMCOLS

REGION

ROW

SERCOUNT