Remove fields from a struct
stout = rmfield(stin, fields)
A struct variable.
String matrix or cell of strings, the names of the fields to remove.
A struct variable having the same dimensions as stin from which some fields have be removed.
The rmfield function removes fields from a struct but without modifying its dimensions.
If fields is an empty matrix or an empty cell, then stin and stout are the same.
st = struct("a", 1, "b", 2, "c", 3, "d", 4) s2 = rmfield(st, []) // No fields will be removed s1 = rmfield(st, "a") s3 = rmfield(st, {"b", "c"}) s4 = rmfield(st, {"b", "c"; "d", "a"}) // All fields will be removed | ![]() | ![]() |
| Version | Description |
| 2025.1.0 | Function rmfield introduced. |