|
SOLUTIONS
|
MATHEMATICA MATHLINK C FUNCTION
MLPutInteger32Array()
int MLPutInteger32Array(MLINK link, int *a, int *dims, char **heads, int d)
puts an array of 32-bit integers to the MathLink connection specified by link to form a depth d array with dimensions dims.
DetailsDetails
- The array a must be laid out in memory like a C array declared explicitly as
. - If heads is given as NULL, the array will be assumed to have head List at every level.
- The length of the array at level
is taken to be
. - MLPutInteger32Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
- Use MLError() to retrieve the error code if MLPutInteger32Array() fails.
- MLPutInteger32Array() is declared in the MathLink header file mathlink.h.
ExamplesExamplesopen allclose all
Basic Examples (1)Basic Examples (1)
#include "mathlink.h"
/* send an array of 32-bit integers to a link */
void f(MLINK lp)
{
int array[6][10][2][1];
int dims[4];
int i;
for(i = 0; i < 120; i++)
*((int *)array + i) = i;
dims[0] = 6;
dims[1] = 10;
dims[2] = 2;
dims[3] = 1;
if(! MLPutInteger32Array(lp, (int *)array, (int *)dims, (char **)0, 4))
{ /* unable to send the array to lp */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
