rmfield

rmfield(s, field) removes from the struct object s, fields specified by field.

Examples

> person = struct('name', 'antonis', 'gender', 'm', 'age', 28, 'height', 1.78, 'weight', 81)

[person:1x1 struct]

> person#

 name: antonis
 gender: m
 age:  28
 height:  1.78
 weight:  81

> rmfield(person,'weight')

> person#

 name: antonis
 gender: m
 age:  28
 height:  1.78

> rmfield(person,['gender';'height'])

> person#

 name: antonis
 age:  28

> rmfield(person,{'age'})

> person#

 name: antonis

> person.name#

antonis

> person.age#

error while trying to access matrix "person" data: "age" identifier not found in struct object

Resources

See also

class | fieldnames | struct