| MATLAB Function Reference | Search  Help Desk |
| fieldnames | Examples See Also |
Syntax
names = fieldnames(s)
Description
names = fieldnames(s)
returns a cell array of strings containing the structure field names associated with the structure s.
Examples
Given the structure:mystr(1,1).name = 'alice'; mystr(1,1).ID = 0; mystr(2,1).name = 'gertrude'; mystr(2,1).ID = 1Then the command
n = fieldnames(mystr) yields
n =
'name'
'ID'
See Also
getfield, setfield