Using the C Math Library | ![]() ![]() |
Selecting the Entire Matrix As a Column Vector
Use the colon index to select all the elements in an array. The result is a column vector. For example,
mlfAssign(&B, mlfIndexRef(A, "(?)", mlfCreateColonIndex()));
1 2 3 4 5 6 7 8 9
The colon index means ``all.'' It is a context-sensitive function. It expands to a vector array containing all the indices of the dimension in which it is used (its context). In the context of an M-by-N array A
, A(:)
in MATLAB notation is equivalent to A([1:M*N]')
. When you use colon, you don't have to specify M and N explicitly, which is convenient when you don't know M and N.
![]() | Selecting a Matrix | N-Dimensional Indexing | ![]() |