mxGetNumberOfFields (C and Fortran) - Get number of fields in structure mxArray

C Syntax

#include "matrix.h"
int mxGetNumberOfFields(const mxArray *pm);

Fortran Syntax

integer*4 mxGetNumberOfFields(pm)
mwPointer pm

Arguments

pm

Pointer to a structure mxArray

Returns

The number of fields, on success. Returns 0 on failure. The most common cause of failure is that pm is not a structure mxArray. Call mxIsStruct to determine whether pm 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, you can loop through every field in order to set or to get field values.

C Examples

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

Additional examples:

See Also

mxGetField, mxIsStruct, mxSetField

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS