OpenersNotesSection(Spacer1)Details

The array a is laid out in memory like a C array declared as double a[m][n]….

heads gives a list of character strings corresponding to the names of symbols that appear as heads at each level in the array.

MLGetRealArray() allocates memory which must be released by calling (NonWLLink[MLDisownRealArray(), paclet:ref/c/MLDisownRealArray]). If MLGetRealArray() fails and the function's return value indicates an error, do not call MLReleaseRealArray() on the contents of a.

MLGetRealArray() returns immutable data.

MLGetRealArray() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:ref/c/MLError]) to retrieve the error code if MLGetRealArray() fails.

MLGetRealArray() is equivalent to (NonWLLink[MLGetReal64Array(), paclet:ref/c/MLGetReal64Array]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* read an array of double-precision floating-point numbers from a link */

void f(MLINK lp)
{
	double *data;
	long *dims;
	char **heads;
	long d; /* stores the rank of the array */

	if(! MLGetRealArray(lp, &data, &dims, &heads, &d))
		{
			/* unable to read the array from lp */
			return;
		}

	/* ... */

	MLDisownRealArray(lp, data, dims, heads, d);	
}

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})