| External Interfaces Reference | ![]() |
Create unpopulated two-dimensional structure mxArray
C Syntax
#include "matrix.h" mxArray *mxCreateStructMatrix(int m, int n, int nfields, const char **field_names);
Arguments
m
The desired number of rows. This must be a positive integer.
n
The desired number of columns. This must be a positive integer.
nfields
The desired number of fields in each element.
field_names
The desired list of field names.
Structure field names must begin with a letter, and are case-sensitive. The rest of the name may contain letters, numerals, and underscore characters. Use the namelengthmax function to determine the maximum length of a field name.
Returns
A pointer to the created structure mxArray if successful, and NULL otherwise. The most likely cause of failure is insufficient heap space to hold the returned mxArray.
Description
mxCreateStructMatrix and mxCreateStructArray are almost identical. The only difference is that mxCreateStructMatrix can only create two-dimensional mxArrays, while mxCreateStructArray can create mxArrays having two or more dimensions.
Examples
See phonebook.c in the refbook subdirectory of the examples directory.
See Also
mxCreateStructArray, mxGetFieldByNumber, mxGetFieldNameByNumber, mxGetFieldNumber, mxIsStruct, namelengthmax
| mxCreateStructArray | mxDestroyArray | ![]() |
© 1994-2005 The MathWorks, Inc.