LibraryLink`
LibraryLink`

MTensor_setInteger

sets a single element of an MTensor of integer type.

Details and OptionsDetails
  • Used in C/C++ code in a library function called from Mathematica.
  • Uses the same numbering scheme as Mathematica parts, i.e. the first element is 1.
  • The array is assumed to have length at least equal to the rank of .
  • A nonzero error code value will be returned if the element does not exist, if is not an MTensor of integer type.
  • Examples

    Basic Examples  (1)

    This sets the element at position 1,1 to be 2:

    MTensor T0;
    mint lens[2];
    int err;
    ...
    lens[0] = 1;
    lens[1] = 1;
    err = libData->MTensor_setInteger( T0, lens, 2);

    See Also

    MTensor_getInteger  MTensor_getIntegerData

    Tutorials