LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking Numeric array with String array

Solved!
Go to solution

Hello,

 

I am trying to create a list of 10 Name and their corresponding scores.  I also need to sort those names alphabetically. 

 

I have started by using one Numeric array for the Scores and a String array for the Names. But my problem starts when the sorted Names do not marry up with their now sorted scores  

 

Is there any way of linking the 2 arrays so that the values of the indexes in the numeric array,  follow names they were initially with once the. 

 

I hope it to look like this:

Unsorted                  Sorted

Peter:  90                 David: 65

David: 65                 Lisa:    99

Lisa: 99                    Peter:  90

Zak: 40                    Zak:      40

 

Any tips or direction will be appreciated!

 

 

0 Kudos
Message 1 of 3
(2,247 Views)
Solution
Accepted by crossrulz

Create an array of clusters, where each cluster contains a name and a score. Then use "sort array". LabVIEW will sort in cluster order, of if the name is the first cluster element, it will primarily sort by that.

 

There are many examples in the forum, one of the simplest is here. (... and it can be further simplified ;))

0 Kudos
Message 2 of 3
(2,244 Views)

Worked a treat! Thanks.

0 Kudos
Message 3 of 3
(2,169 Views)