#### 6.1.3 Manipulating Structures

Other functions that can manipulate the fields of a structure are given below.

— Built-in Function: fieldnames (struct)

> Return a cell array of strings naming the elements of the structure struct. It is an error to call `fieldnames` with an argument that is not a structure.

— Built-in Function: isfield (expr, name)

> Return true if the expression expr is a structure and it includes an element named name. The first argument must be a structure and the second must be a string.

— Function File: [v1, ...] = getfield (s, key, ...)

> Extract fields from a structure. For example

>               ss(1,2).fd(3).b = 5;
>               getfield (ss, {1,2}, "fd", {3}, "b")
>                ans = 5

> Note that the function call in the previous example is equivalent to the expression

>               i1 = {1,2}; i2 = "fd"; i3 = {3}; i4= "b";
>               ss(i1{:}).(i2)(i3{:}).(i4)

> See also: setfield, rmfield, isfield, isstruct, fieldnames, struct.

— Function File: substruct (type, subs, ...)

> Create a subscript structure for use with `subsref` or `subsasgn`.

> See also: subsref, subsasgn.