Mathematica > Systems Interfaces & Deployment > C/C++ Language Interface > MathLink C Language Functions >
Mathematica > Systems Interfaces & Deployment > MathLink API > MathLink C Language Functions >
MathLink C Function

MLPutReal32Array()

int MLPutReal32Array(MLINK link, float *a, int *dims, char **heads, int d)
puts an array of single-precision floating-point numbers to the MathLink connection specified by link to form a depth d array with dimensions dims.
  • The array a must be laid out in memory like a C array declared explicitly as float a[m][n]....
  • 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 i is taken to be dims[i].
  • MLPutReal32Array() returns 0 in the event of an error and a nonzero value otherwise.
  • Use MLError() to retrieve the error code if MLPutReal32Array() fails.
  • MLPutReal32Array() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* put an array of single-precision floating-point numbers to a link */

void f(MLINK lp)
{
    float array[2][10][2];
    long dims[3];
    int i;

    for(i = 0; i < 40; i++)
        *((float *)array +i) = i + .2;

    dims[0] = 2;
    dims[1] = 10;
    dims[2] = 2;

    if(! MLPutReal32Array(lp, (float *)array, (int *)dims, (char **)0, 3))
        { /* unable to send the array to lp */ }
}
© 2008 Wolfram Research, Inc.
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team