names = fieldnames(st)
names = fieldnames(obj)
names = fieldnames(objArray)
| Parameter | Description |
|---|---|
| st | a structure |
| obj | a classdef object or handle object |
| objArray | a classdef object array or handle array |
| Parameter | Description |
|---|---|
| names | a cell of strings |
fieldnames(st) returns a cell of strings with the field names of the input structure.
For classdef objects, fieldnames(obj) returns the same public property names as properties(obj).
For classdef object arrays, the returned names are the public properties of the array element class.
clear classes
d = [tempdir(), 'nelson_help_fieldnames/'];
mkdir(d);
filewrite([d, '/NelsonHelpFieldPoint.m'], ["classdef NelsonHelpFieldPoint"; " properties"; " X = 0"; " Y = 0"; " end"; "end"]);
addpath(d);
a = NelsonHelpFieldPoint();
b = NelsonHelpFieldPoint();
names = fieldnames([a, b])
| Version | Description |
|---|---|
| 1.0.0 | initial version |
| 2.0.0 | classdef object support added |