| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "matrix.h" mxArray *mxCreateStructMatrix(mwSize m, mwSize n, int nfields, const char **fieldnames);
mwPointer mxCreateStructMatrix(m, n, nfields, fieldnames) mwSize m, n integer*4 nfields character*(*) fieldnames(nfields)
Number of rows. This must be a positive integer.
Number of columns. This must be a positive integer.
Number of fields in each element.
List of field names.
Each structure field name must begin with a letter and is 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.
Pointer to the created structure mxArray if successful, and NULL in C (0 in Fortran) otherwise. The most likely cause of failure is insufficient heap space to hold the returned mxArray.
mxCreateStructMatrix and mxCreateStructArray are almost identical. The only difference is that mxCreateStructMatrix can create only two-dimensional mxArrays, while mxCreateStructArray can create mxArrays having two or more dimensions.
See phonebook.c in the matlabroot/extern/examples/refbook folder .
![]() | mxCreateStructArray (C and Fortran) | mxDestroyArray (C and Fortran) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |