N-D numeric array
#include "matrix.h" mxArray *mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity ComplexFlag);
Use mxCreateNumericArray
to create an N-dimensional
mxArray
. The data elements have the numeric data type specified by
classid
.
mxCreateNumericArray
differs from mxCreateDoubleMatrix
as follows:
All data elements in mxCreateDoubleMatrix
are double-precision,
floating-point numbers. The data elements in mxCreateNumericArray
can
be any numerical type, including different integer precisions.
mxCreateDoubleMatrix
creates two-dimensional arrays only.
mxCreateNumericArray
can create arrays of two or more
dimensions.
MATLAB® automatically removes any trailing singleton dimensions specified in the
dims
argument. For example, if ndim
equals
5
and dims
equals [4 1 7 1 1]
, then
the resulting array has the dimensions
4
-by-1
-by-7
.
This table shows the C classid
values that are equivalent to
MATLAB classes.
MATLAB Class Name | C |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Call mxDestroyArray
when you finish using the
mxArray
. The mxDestroyArray
function deallocates the
mxArray
and its associated real and imaginary elements.
See these examples in
:matlabroot
/extern/examples/refbook
See these examples in
:matlabroot
/extern/examples/mx
mxClassID
| mxComplexity
| mxCreateNumericMatrix
| mxCreateUninitNumericArray
| mxDestroyArray