| MATLAB C++ Math Library | Search  Help Desk |
| end | See Also |
Generate the last index for an array dimension
C++ Prototype
mwArray end(mwArray &mat, mwArray &x, mwArray &y);
Arguments
matend() is used. (1 = row , 2 = column)
y
C++ Syntax
This example selects all but the first element in row three from arrayA :
A(3, colon(2, end(A, 2, 2)));
MATLAB Syntax
A(3, 2:end)
Description
end(&mat, &x, &y) generates the last index for an array dimension. It acts like end in the MATLAB expression A(3, 6:end). x is the dimension to compute end for.
The end() function, which corresponds to the MATLAB end() function, provides another way of specifying a vector index. Given an array, a dimension (1 = row , 2 = column), and the number of indices in the subscript, end() returns the index of the last element in the specified dimension. Given the row dimension, end() returns the number of columns. Given the column dimension, it returns the number of rows. For a matrix and one-dimensional indexing, end() treats the matrix as a vector and returns the number of elements in the matrix.
See Also
end Calling Conventions