External Interfaces/API Reference    
mxGetFieldNameByNumber

Get a field name, given a field number in a 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 name; field_number 1 represents field name billing; field_number 2 represents field name 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


  mxGetFieldByNumber mxGetFieldNumber