| MATLAB Compiler | ![]() |
mwArray GetA(int num_indices, const int* index)
Return single element at the specified 1-based index. The index is passed as an array of 1-based indices.
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 num_indices containing the indices.
Return value
An mwArray containing the value at the specified index.
Description
Use this method to fetch a single element at a specified index. The index is passed by first passing the number of indices, followed by an array of 1-based indices. The valid number of indices that can be passed in is either 1 (single subscript indexing), in which case the element at the specified 1-based offset is returned, accessing data in column-wise order, or NumberOfDimensions() (multiple sub-script indexing), in which case, the index list is used 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 number of indices is passed in or if any index is out of bounds.
| mwArray Get(const char* name, int num_indices, ...) | mwArray GetA(const char* name, int num_indices, const int* index) | ![]() |
© 1994-2005 The MathWorks, Inc.