Skip to content

rmfield

Remove fields from a structure.

s = rmfield(s, field)

Returns a copy of s with the named field (or fields, if a cell array of names is given) removed.

s.a = 1; s.b = 2; s.c = 3;
rmfield(s, 'b') % struct with fields a, c only
rmfield(s, {'a', 'c'}) % struct with field b only
  • setfield — Set the value of a structure field by name.
  • fieldnames — List of field names in a structure.