LIBRARY LINK 符号

MTensor_getIntegerData


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

更多信息更多信息

  • 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 an integer MTensor.

范例范例打开所有单元关闭所有单元

基本范例 (1)基本范例 (1)

This iterates over the data elements of an MTensor:

MTensor T0;
mint* data;
mint i, len;
...
len = libData->MTensor_getFlattenedLength( T0);
data = libData->MTensor_getIntegerData( T0);
for (i = 0; i < len; i++) {
mint elem = data[i];
...
}
New to Mathematica? Find your learning path »
Have a question? Ask support »