Main Content

Order fields of structure array

matches the order specified by the permutation vector `S`

= orderfields(`S1`

,`P`

)`P`

.

If `S1`

has `n`

fields, then the elements of
`P`

are the integers from `1`

through
`n`

, arranged in any order. For example, if `S1`

has
three fields and `P`

is `[3 1 2]`

, then the third field of
`S1`

is the first field of the output `S`

. This syntax
is useful for ordering multiple structure arrays in the same way.

The

`orderfields`

function only orders top-level fields. It is not recursive.

`cell2struct`

| `fieldnames`

| `getfield`

| `isfield`

| `rmfield`

| `setfield`

| `struct`

| `struct2cell`