Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Fill mxArray

Options

You can move data from a C/C++ program into an mxArray using the Matrix Library. The functions you use depend on the type of data in your application. Use the mxSetPr and mxGetPr functions for data of type double. For numeric data other than double, use the mxSetData function. For nonnumeric data, see the examples for the mxCreateString function.

The following examples use a variable. data, to represent data from a computational routine. Each example creates an mxArray using the mxCreateNumericMatrix function, fills it with data, and returns it as the output argument plhs[0].

These examples use real data only. If you have complex data, use the mxGetPi and mxSetPi functions as needed.

Copying Data Directly into an mxArray

The arrayFillGetPr.c example uses the mxGetPr function to copy the values from data to plhs[0].

Pointing to Data

The arrayFillSetPr.c example uses the mxSetPr function to point plhs[0] to data.

The example arrayFillSetData.c shows how to fill an mxArray for numeric types other than double.

See Also

| | |

Related Topics

Was this topic helpful?