rmfield
Remove fields from a struct
Syntax
stout = rmfield(stin, fields)
Arguments
- stin
- A struct variable. 
- fields
- String matrix or cell of strings, the names of the fields to remove. 
- stout
- A struct variable having the same dimensions as - stinfrom which some fields have be removed.
Description
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.
Examples
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
See also
- struct — строит структуру или массив структур
- fieldnames — получает имена полей переменных типа tlist, mlist или struct
History
| Версия | Описание | 
| 2025.1.0 | Function rmfieldintroduced. | 
| Report an issue | ||
| << rlist | Data Structures | setfield >> |