| MATLAB Function Reference | Search  Help Desk |
| fieldnames | Examples See Also |
names = fieldnames(s)
names = fieldnames(s)
returns a cell array of strings containing the structure field names associated with the structure s.
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'
getfield Get field of structure array
setfield Set field of structure array