Access one or more columns of an array. More...

array col (int index) const
 Access column index to form column vector. More...
 
array cols (int first, int last) const
 Access columns first through last to form a matrix (inclusive) More...
 

Detailed Description

Access one or more columns of an array.

The column indexing functions return elements located in the specified column(s).

If the array is 3-dimensional or higher, then the specified columns from all slices are returned.

Function Documentation

array col ( int  index) const
inline

Access column index to form column vector.

float f[] = {1,2,3,4};
array a(2,2,f); //a=[1 3]
// [2 4]
array b = a.col(1); //b = [3]
// [4]
Parameters
[in]indexcolumn index
Returns
Returns an array of size dims(0) x 1 x dims(2)
Note
Cannot be used in gfor. Use array(span, index, span) instead.
Complex Support
OpenCL Support
CUDA Support
Examples:
examples/getting_started/integer.cpp, and examples/helloworld/helloworld.cpp.
array cols ( int  first,
int  last 
) const
inline

Access columns first through last to form a matrix (inclusive)

float f[] = {1,2,3,4,5,6};
array a(2,3,f); //a=[1 3 5]
// [2 4 6]
array b = a.cols(0,1); //b=[1 3]
// [2 4]
Parameters
[in]firstbeginning column index
[in]lastend column index
Returns
Returns an array of size dims(0) x (last - first + 1) x dims(2)
Note
Cannot be used in gfor. Use array(span, seq(first, last), span) instead.
Complex Support
OpenCL Support
CUDA Support