User`s guide

mwArray G etA(mwSize num_indices, const mwIndex*
index)
Purpose Return single element at specified 1-based index
C++
Syntax
#include "mclcppclass. h"
double data[4] = {1.0, 2.0, 3.0, 4.0};
int index[2] = {1, 1};
double x;
mwArray a(2, 2, mxDOUBLE_CLASS);
a.SetData(data, 4);
x = a.GetA(1, index); // x = 1.0
x = a.GetA(2, index); // x = 1.0
index[0] = 2;
index[1] = 2;
x = a.Get(2, index); // x = 4.0
Arguments num_indices
Size of index array
index
Array of at least size nu m_in dices containing the indices
Return
Value
An mwArray containing the value at the specified index.
Description Use this m ethod to fetch a single element at a specified index. The
index is passed by first passing the number o f indices, f ollow ed b y a n
array of 1-bas ed indices. The valid number of indices that can be passed
in is either 1 (singl e su bscript indexi n g ) , in which case the ele m ent at
the specified 1-based offset is returned, accessing data in column-wise
order, or
NumberOfDimensions() (multiple sub-script indexing), in
which case, the ind ex list i s u sed to access the specified element. The
valid range for indices is
1 <= index <= NumberOfElements(),for
single subscript indexing. For multiple subscript indexing, the ith index
has the valid range:
1 <= index[i] <= GetDimensions().Get(1, i).
An
mwException is thrown if an invalid nu m ber of indices is passed in
or if any index is out of bounds.
C-72