| MATLAB Function Reference | ![]() |
Return field names of structure, or public fields of 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 a MATLAB, COM, or 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 a MATLAB, COM, or Java object.
Examples
the command n = fieldnames(mystr) yields
In another example, if f is an object of Java class java.awt.Frame, the command fieldnames(f) lists the properties of f.
f = java.awt.Frame; fieldnames(f) ans = 'WIDTH' 'HEIGHT' 'PROPERTIES' 'SOMEBITS' 'FRAMEBITS' 'ALLBITS' . .
See Also
setfield, getfield, isfield, orderfields, rmfield, dynamic field names
| fgets | figflag | ![]() |
© 1994-2005 The MathWorks, Inc.