mxCreateStructArray (C)
N-D structure array
C Syntax
#include "matrix.h" mxArray *mxCreateStructArray( mwSize ndim, const mwSize *dims, int nfields, const char **fieldnames);
Description
Call mxCreateStructArray
to create an unpopulated structure
mxArray
. Each element of a structure mxArray
contains
the same number of fields (specified in nfields
). Each field has a name,
specified in fieldnames
. A MATLAB® structure mxArray
is conceptually identical to an array of
structs
in the C language.
Each field holds one mxArray
pointer initialized to
NULL
. Call mxSetField
or
mxSetFieldByNumber
to place a non-NULL
mxArray
pointer in a field.
The function automatically removes trailing singleton dimensions specified in the
dims
argument. For example, if ndim
equals
5
and dims
equals [4 1 7 1 1]
, then
the dimensions of the resulting array are
4
-by-1
-by-7
.
Call mxDestroyArray
when you finish using the
mxArray
to deallocate the mxArray
and its associated
elements.
Input Arguments
Output Arguments
Version History
Introduced before R2006a
See Also
mxDestroyArray
| mxAddField
| mxRemoveField
| mxSetField
| mxSetFieldByNumber
| namelengthmax