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.

mxAddField (C and Fortran)

Add field to structure array

C Syntax

#include "matrix.h"
extern int mxAddField(mxArray *pm, const char *fieldname);

Fortran Syntax

#include "fintrf.h"
integer*4 mxAddField(pm, fieldname)
mwPointer pm
character*(*) fieldname



Pointer to a structure mxArray


Name of the field you want to add


Field number on success, or -1 if inputs are invalid or an out-of-memory condition occurs.


Call mxAddField to add a field to a structure array. Create the values with the mxCreate* functions and use mxSetFieldByNumber to set the individual values for the field.

Introduced before R2006a

Was this topic helpful?