Scooter_X Posted April 9, 2009 Report Share Posted April 9, 2009 Hello everyone. New here. Hi. Hey I'm doing a project in my LabVIEW class to program a 'Pinewood Derby' racetrack. I won't explain the whole thing, that would get boring. I really just want to know how I could make an indexable, sortable array with one column being a string - the name of the car/racer, and the other column being the car/racer's race time. I've tried to just turn my number into a string, then concatenating both strings and stuffing them into my array. But then I can't sort my array in order of race time (it's going to have several racers' times in the same array) because the only relevant node I could find only dealt with numeric arrays. I would really appreciate some help on this. My partner and I both are a little stumped. Thanks in advance! -Scooter Quote Link to comment
JustinThomas Posted April 9, 2009 Report Share Posted April 9, 2009 Hi Scooter X, You can use a cluster with one string and one numeric for each racer build an array of this for your data. Clusters allow you to keep different data type elements together. As far as the sorting goes I am not aware of any ready made functions for sorting a cluster. You may have to write custom code for sorting your cluster, but should not be very challenging. Justin Thomas Quote Link to comment
jgcode Posted April 9, 2009 Report Share Posted April 9, 2009 QUOTE (JustinThomas @ Apr 8 2009, 12:57 PM) Hi Scooter X,You can use a cluster with one string and one numeric for each racer build an array of this for your data. Clusters allow you to keep different data type elements together. As far as the sorting goes I am not aware of any ready made functions for sorting a cluster. You may have to write custom code for sorting your cluster, but should not be very challenging. Justin Thomas You can sort a 1D cluster array with the native LabVIEW function. Quote Link to comment
Justin Reina Posted April 9, 2009 Report Share Posted April 9, 2009 hello jgcode, There may be, and probably is a better way out there, but you can use the 'sort 1D array' function. Just be careful of the order of the elements in your cluster. See the attached example. Best of Luck, Justin Quote Link to comment
Scooter_X Posted April 9, 2009 Author Report Share Posted April 9, 2009 Thanks guys for your suggestions. I did actually try a cluster yesterday, but it was giving me a bit of a fit too... I'll keep trying. That's what made the most sense to me as well. And yea then I'd have to try something of my own to sort it out properly. I'll keep trying and I'll let my amigo know what's up too, maybe he has some other ideas by now. Thanks, guys! I'll likely be back later for something else. Take care for now. :thumbup: Quote Link to comment
jdunham Posted April 9, 2009 Report Share Posted April 9, 2009 QUOTE (Scooter_X @ Apr 8 2009, 06:54 AM) And yea then I'd have to try something of my own to sort it out properly. No, the sorting is easy! As the others mentioned 1D Sort Array works great on clusters. Be sure to read the help about it, and post back if you have difficulty. Quote Link to comment
Neville D Posted April 9, 2009 Report Share Posted April 9, 2009 The OpenG array toolkit has a VI that can sort 2-d arrays (of any datatype) as well. You will need the most-excellent VIPM from JKI to download the toolkit. N. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.