Main Content

mxCreateStructMatrix (C)

2-D structure array

C Syntax

#include "matrix.h" mxArray *mxCreateStructMatrix(mwSize m, mwSize n, int nfields, const char **fieldnames);

Description

CallmxCreateStructMatrixto create an unpopulated, two-dimensional, structuremxArray. For information about the structure, seemxCreateStructArray.

CallmxDestroyArraywhen you finish using themxArrayto deallocate themxArrayand its associated elements.

Input Arguments

expand all

Number of rows, specified asmwSize.

Number of columns, specified asmwSize.

Number of fields in each element, specified asint.

One or more field names, specified asconst char **.

Field names must be valid MATLAB®identifiers, which means they cannot beNULLor empty. Field names are case-sensitive. To determine the maximum length of a field name, use thenamelengthmaxfunction.

Output Arguments

expand all

Pointer to anmxArray, specified asmxArray *, if successful.

The function is unsuccessful when there is not enough free heap space to create themxArray.

  • MEX file — Function terminates the MEX file and returns control to the MATLAB prompt.

  • Standalone (non-MEX file) application — Function returns0.

Examples

See these examples inmatlabroot/extern/examples/refbook:

Introduced before R2006a