MATLAB Function Reference    
fieldnames

Return field names of a structure, or property names of a MATLAB object or Java object

Syntax

Description

names = fieldnames(s) returns a cell array of strings containing the structure field names associated with the structure s.

names = fieldnames(obj) returns a cell array of strings containing the names of the public data fields associated with obj, which is either a MATLAB or a Java object.

names = fieldnames(obj,'-full') returns a cell array of strings containing the name, type, attributes, and inheritance of each field associated with obj, which is either a MATLAB or a Java object.

Examples

Given the structure

the command n = fieldnames(mystr) yields

In another example, if x is an object of Java class java.awt.Frame, the command fieldnames(x) results in the display

See Also

getfield, setfield, rmfield


 fgets (serial) figflag