mxGetNumberOfFields (C and Fortran)
Number of fields in structure array
C Syntax
#include "matrix.h" int mxGetNumberOfFields(const mxArray *pm);
Fortran Syntax
#include "fintrf.h" integer*4 mxGetNumberOfFields(pm) mwPointer pm
Arguments
pmPointer to a structure
mxArray
Returns
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 to set or to get field values.
Examples
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","refbook","filename")]);
where filename is:
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","mx","filename")]);
where filename is:
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","mex","filename")]);
where filename is:
See Also
Version History
Introduced before R2006a