rmfield

Returns a copy of the structure s with the field f removed.

Syntax

rmfield(s,'f')

Inputs

s
Struct.
Type: struct
Dimension: scalar | vector | matrix
f
Field to be removed.
Type: char | string
Dimension: string

Outputs

R
Resulting struct. The original struct s is not modified.

Example

Simple rmfield example.

a = struct('name', {'Bob', 'Dave'}, 'age', {33, 44});
R = rmfield(a, 'age');
R(1)
R(2)
ans = struct [
name: Bob
]
ans = struct [
name: Dave
]