11-13-2022 10:47 AM
I have 2 array,
1st array contains number 1 to 9 in a random order ,
2nd array contains random number,
I want to : sort array1 , then sort array2 according to array 1 sorting order , for example:
array1 : 1,2,3,4,5,6,8,9,7
array2 : 464,353,345,456,567,678,88,99,77
after sorting (element 9 become 7, 8 become 9, 7 become 8):
array1 : 1,2,3,4,5,6,7,8,9
array2 : 464,353,345,456,567,678,77,88,99
Solved! Go to Solution.
11-13-2022 11:18 AM - edited 11-13-2022 11:28 AM
11-13-2022 11:20 AM
11-14-2022 11:53 AM
ah I never use index and bundle cluster array, I didn't concatenate them because I thought it will also sort the 2nd array.
thanks !
11-14-2022 12:04 PM
Arrays of cluster will sort by cluster order. The values of the second element are only relevant where there are duplicates in the first value.
11-14-2022 09:15 PM
got it , thanks so much !
11-15-2022 02:54 PM
I made a set of Array manipulation code posted over on VIPM.IO which supports many additional function as VIMs so that the data types can transform as needed. One of the functions I named the Foreign Key Sort, which sorts one array based on another. Under the hood it basically does what others have suggested here, but it does return other optional things such as the pointers (indexes) of how the rearrange went.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord