*SORT

*SORT, Name, SortType, Val1, Val2
Sorts the values of the specified vector.

Compatible Products: – | Pro | Premium | Enterprise | Ent PP | Ent Solver | DYNA

Argument Descriptions

Name

Name of the vector to be sorted. This vector can contain real or complex values.

SortType

Criteria used to sort the values:

VALUE –

Values are sorted based on their real value (default).

ABS –

Values are sorted based on their absolute value.

PERM –

Values are sorted based on the input permutation vector (Val1).

Val1, Val2

Additional input. The meaning of Val1, Val2 varies depending on the specified SortType. See below for details.

The following Valx fields are used with SortType = VALUE or ABS:

Val1

Name of the vector in which permutation values will be saved (optional). This should be an empty vector of type integer that was created with the *VEC command. The size of this permutation vector must be identical to the size of the vector to be sorted. After the sort, this vector contains the permutation used to sort the values.

Val2

Order of the sort operation:

0 –

Increasing order (default).

1 –

Decreasing order.

The following Valx fields are used with Method = PERM:

Val1

Name of the permutation vector used to sort the values. This must be a vector of integer values that was created with the *VEC command. The size of this permutation vector must be identical to the size of the vector to be sorted.

This permutation vector is required when using Method = PERM.

Notes

The examples below demonstrate using *SORT to sort the values of an input vector.

The following input:

*VEC,V,I,ALLOC,5
V(1)=5,-3,2,0,-1
*SORT,V,VALUE
*PRINT,V

generates this output:

       -3        -1         0         2         5

To reverse the order, this input:

*SORT,V,VALUE,,1
*PRINT,V

generates this output:

        5         2         0        -1        -3

Menu Paths

This command cannot be accessed from a menu.

Release 18.2 - © ANSYS, Inc. All rights reserved.