LibraryLink`
LibraryLink`

MNumericArray_getData (C Function)

gets a void pointer to an array of the data elements of an MNumericArray.

Details

  • Used in C/C++ code in a library function called from the Wolfram Language.
  • The array has a length equal to the flattened length.

Examples

Basic Examples  (1)

This iterates over the data elements of an MNumericArray:

MNumericArray A;
numericarray_data_t type;
unsigned char* data;
mint i, len;

...
len = libData->numericarrayLibraryFunctions->MNumericArray_getFlattenedLength(A);
type = libData->numericarrayLibraryFunctions->MNumericArray_getType(A);
if (type == MNumericArray_Type_Ubit8) {
data = (unsigned char*)(libData->numericarrayLibraryFunctions->MNumericArray_getData(A));
for (i = 0; i < len; i++) {
unsigned char elem = data[i];
...
}
}