External Interfaces/API Reference    
mxGetNumberOfFields

Get the number of fields in a structure mxArray

C Syntax

Arguments

array_ptr
   Pointer to a structure mxArray.

Returns

The number of fields, on success. Returns 0 on failure. The most common cause of failure is that array_ptr is not a structure mxArray. Call mxIsStruct to determine if array_ptr is a structure.

Description

Call mxGetNumberOfFields to determine how many fields are in the specified structure mxArray.

Once you know the number of fields in a structure, it is easy to loop through every field in order to set or to get field values.

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; see explore.c in the mex subdirectory of the examples directory.

See Also

mxGetField, mxIsStruct, mxSetField


  mxGetNumberOfElements mxGetNzmax