mxArray (C)
C type for MATLAB array
Description
The fundamental type underlying MATLAB® data. mxArray is a C language opaque type. The header
file containing this type is:
#include "matrix.h"
For information on how mxArray works with MATLAB-supported variables, see MATLAB Data.
All C MEX files start with a gateway routine, called mexFunction,
which requires mxArray for both input and output parameters. For
information about the C MEX file gateway routine, see Components of C MEX File.
Once you have MATLAB data in your MEX file, use functions in the C Matrix API to manipulate the
data and functions in the C MEX API to perform operations in the MATLAB environment. Use mxArray to pass data to and from these
functions.
Example
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","mx","filename")]);
where filename is:
Limitations
In Simulink® S-functions, do not store
plhsmxArraypointers in any S-function block state that persists after the MEX function finishes. An outputmxArrayhas temporary scope and is automatically destroyed at the end of the MEX function call.
Tips
For information about data in MATLAB language scripts and functions, see Data Types.
For troubleshooting
mxArrayerrors in other MathWorks products, search the documentation for that product.
Version History
Introduced before R2006a