MTensor_getRealData

gets an array of the data elements of an MTensor of real type.

Details and OptionsDetails
  • Used in C/C++ code in a library function called from Mathematica.
  • The array has a length equal to the flattened length.
  • Will cause an error to be launched if the tensor is not a real MTensor.
  • Examples

    Basic Examples  (1)

    This iterates over the data elements of an MTensor:

    MTensor T0;
    double* data;
    mint i, len;
    ...
    len = libData->MTensor_getFlattenedLength( T0);
    data = libData->MTensor_getRealData( T0);
    for (i = 0; i < len; i++) {
    double elem = data[i];
    ...
    }

    See Also

    MTensor_getReal  MTensor_setReal

    Tutorials