Main Content
getfield
Field of structure array
Syntax
Description
value = getfield(
returns the value in the specified field of the structure S
,field
)S
. For
example, if S.a = 1
, then getfield(S,'a')
returns 1
.
As an alternative to getfield
, use dot notation, value
= S.field
. Dot notation is typically more efficient.
If S
is nonscalar, then getfield
returns
the value in the first element of the array, equivalent to
S(1).field
.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced before R2006a
See Also
setfield
| fieldnames
| isfield
| orderfields
| rmfield
| struct