orderfields
Order fields of structure array
Syntax
Description
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.
Examples
Input Arguments
Output Arguments
Tips
The
orderfields
function only orders top-level fields. It is not recursive.
Extended Capabilities
Version History
Introduced before R2006a
See Also
struct
| isfield
| fieldnames
| setfield
| getfield
| rmfield
| struct2cell
| cell2struct