isfield
Test whether a structure contains a named field.
Syntax
Section titled “Syntax”tf = isfield(s, fieldname)Description
Section titled “Description”Returns true if s is a structure containing a field named fieldname. With a cell array of field names, returns a logical array — one element per name.
Examples
Section titled “Examples”s.x = 1;isfield(s, 'x') % 1isfield(s, {'x', 'y'}) % [1 0]See also
Section titled “See also”fieldnames— List of field names in a structure.isstruct— Test whether the input is a structure.