| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "matrix.h" int mxGetNumberOfFields(const mxArray *pm);
integer*4 mxGetNumberOfFields(pm) mwPointer pm
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.
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.
See phonebook.c in the matlabroot/extern/examples/refbook folder .
Additional examples:
mxisclass.c in the matlabroot/extern/examples/mx folder
explore.c in the matlabroot/extern/examples/mex folder .
mxGetField, mxIsStruct, mxSetField
![]() | mxGetNumberOfElements (C and Fortran) | mxGetNzmax (C and Fortran) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |