Owning Palette: Array VIs and Functions
Requires: Base Development System
Rearranges the rows or columns of a 2D array by sorting the elements in the specified column or row in ascending order.
This VI rearranges the elements in the specified column or row in ascending order by comparing the elements using comparison rules for different data types.
Add to the block diagram | Find on the palette |
The example below demonstrates how this VI sorts the following 2D array if dimension to index is column.
Alice | 28 | Female | developer |
Robert | 31 | Male | Manager |
David | 29 | Male | Technician |
Kate | 29 | Female | Engineer |
If index is 1, this VI returns the following array.
Alice | 28 | Female | developer |
David | 29 | Male | Technician |
Kate | 29 | Female | Engineer |
Robert | 31 | Male | Manager |
Note If multiple rows have the same element for the indexed column, this VI keeps the original order of rows. |
If index is 3, this VI returns the following array.
Kate | 29 | Female | Engineer |
Robert | 31 | Male | Manager |
David | 29 | Male | Technician |
Alice | 28 | Female | developer |
Note For string elements, this VI rearranges the elements based on case-sensitivity. In this example, the indexed column contains the following elements: developer, Manager, Technician, Engineer. This VI rearranges this column to Engineer, Manager, Technician, developer. |
If index is {2, 0}, this VI returns the following array.
Alice | 28 | Female | developer |
Kate | 29 | Female | Engineer |
David | 29 | Male | Technician |
Robert | 31 | Male | Manager |
Note If index is an array, this VI rearranges the elements in the indexed columns in order. In this example, this VI rearranges first the elements in column 2 to be ascending, and then the elements in column 0. |
Refer to the Malleable VIs Basics.lvproj in the labview\examples\Malleable VIs\Basics directory for an example of using the Sort 2D Array VI.