Assign value to structure array field
S = setfield(
assigns a value to the specified field of the structure S
,field
,value
)S
. For example,
S = setfield(S,'a',1)
makes the assignment S.a =
1
.
As an alternative to setfield
, use dot notation: S.field =
value
. Dot notation is typically more efficient.
If S
does not have the specified field, then
setfield
creates it and assigns value
to
it.
fieldnames
| getfield
| isfield
| orderfields
| rmfield
| struct