Using the C++ Math Library | ![]() ![]() |
The mwIndex Class
mwArray
overloads the ()
operator for MATLAB-like indexing. The mwArray::operator()
functions can accept mwIndex
objects. An mwIndex
can represent a single integer, a sequence of integers specified by a tuple (start, step, stop), or an arbitrary vector of integers. Array subscripts are always integers; the MATLAB C++ Math Library truncates floating-point numbers to integers in indexing expressions.
You can create mwIndex
objects in several ways. The way most familiar to MATLAB users is the colon()
function. An mwIndex
constructor exists for each form of the colon()
function, as this table demonstrates.
Note
The default mwIndex constructor (entry one in the table below) produces an mwIndex object representing : (colon). |
![]() | C++ and MATLAB Indexing Syntax | Programming Efficient Indices | ![]() |