Return a struct with fields arranged alphabetically or as specified by s2 and a corresponding permutation vector.

Given one struct, arrange field names in s1 alphabetically.

Given two structs, arrange field names in s1 as they appear in s2 . The second argument may also specify the order in a permutation vector or a cell array of strings.

See also: getfield, rmfield, isfield, isstruct, fieldnames, struct.