Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mxCreateStructMatrix (C and Fortran)

2-D structure array

C Syntax

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

Fortran Syntax

mwPointer mxCreateStructMatrix(m, n, nfields, fieldnames)
mwSize m, n
integer*4 nfields
character*(*) fieldnames(nfields)

Arguments

m

Number of rows; must be a positive integer.

n

Number of columns; must be a positive integer.

nfields

Number of fields in each element.

fieldnames

List of field names.

Each structure field name must begin with a letter and is case-sensitive. The rest of the name can contain letters, numerals, and underscore characters. To determine the maximum length of a field name, use the namelengthmax function.

Returns

Pointer to the created mxArray, if successful. If unsuccessful in a standalone (non-MEX file) application, returns NULL in C (0 in Fortran). If unsuccessful in a MEX file, the MEX file terminates and returns control to the MATLAB® prompt. The function is unsuccessful when there is not enough free heap space to create the mxArray.

Description

mxCreateStructMatrix and mxCreateStructArray are almost identical. The only difference is that mxCreateStructMatrix can create only two-dimensional mxArrays, while mxCreateStructArray can create an mxArray having two or more dimensions.

C Examples

See the following examples in matlabroot/extern/examples/refbook.

Introduced before R2006a

Was this topic helpful?