External Interfaces Reference Previous page   Next Page
mxGetFieldNameByNumber

Get field name, given field number in structure array

C Syntax

Arguments

array_ptr
   Pointer to a structure mxArray.

field_number
   The position of the desired field. For instance, to get the name of the first field, set field_number to 0; to get the name of the second field, set field_number to 1; and so on.

Returns

A pointer to the nth field name, on success. Returns NULL on failure. Common causes of failure include:

Description

Call mxGetFieldNameByNumber to get the name of a field in the given structure mxArray. A typical use of mxGetFieldNameByNumber is to call it inside a loop in order to get the names of all the fields in a given mxArray.

Consider a MATLAB structure initialized to

The field number 0 represents the field name; field number 1 represents field billing; field number 2 represents field test. A field number other than 0, 1, or 2 causes mxGetFieldNameByNumber to return NULL.

Examples

See phonebook.c in the refbook subdirectory of the examples directory.

For additional examples, see mxisclass.c in the mx subdirectory of the examples directory and explore.c in the mex subdirectory of the examples directory.

See Also

mxGetField, mxIsStruct, mxSetField


Previous page  mxGetFieldByNumber mxGetFieldNumber Next page

© 1994-2005 The MathWorks, Inc.