FUNCTION REFERENCE

numfields

Count a struct's fields.

Count a struct's fields.

Syntax

numfields(S)

Returns a double scalar counting the field names, independently of the number of struct elements. Empty structs can still have fields. Exactly one struct input is required.

Example

numfields(struct('a',1,'b','x'))   % 2

Differences from MATLAB: Not checked against MATLAB yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.