SortVectors()
Summary
Sorts an array of vectors in ascending order, based on the first vector.
Changes
Added to Version 6.0/2012.
Syntax
sort_array = SortVectors(array vecs [, array options])
| Argument | Contents |
|---|---|
| vecs | The array of vectors to be sorted, based on the first vector |
| Option | Type | Contents |
|---|---|---|
| Omit Missing | Boolean | If "True"omits the elements in all the vectors when the first vector has a missing value; if "False" (the default) all elements of all the vectors will be included |
| Unique | Boolean | If "True" will return the elements where the first vector is unique; the default is "False" |
Returns
A new array of vectors, with the elements in each vector sorted based on the first vector.
Notes
-
The options array is an optional argument.
-
Nulls are sorted to the beginning.
-
The vectors in the array must be the same length, but can be of different types.
-
For more information on vectors, see Vectors.
Example
a1 = {3.3, 2.2, 1.1}
a2 = {232,434,211}
v1 = a2v(a1)
v2 = a2v(a2)
vecs = SortVectors({v1,v2},)
ShowArray(vecs)
See Also
| Function | Summary |
|---|---|
| ArrayToVector() | Copies an array to a vector |
| CopyVector() | Copies a vector to a new vector |
| CumulativeVector() | Constructs a cumulative vector in a new vector |
| SortArray() | Sorts the elements of an array |
| SortVector() | Sorts the elements of a vector in ascending order |
| TransposeArray() | Transposes an array of arrays, where element b[i][j] = a[j][i] |
| Vector() | Creates a vector |
| VectorToArray() | Copies a vector to an array |