04-17-2015 07:23 PM - edited 04-17-2015 07:23 PM
This week I had the task of building a timing system for a Pinewood Derby track. This particular track has only three lanes, so I only need to worry about three results. I figured that I would simply write a VI that would take three numbers and output three strings ("First" "Second" and "Third") corrisponding to each lane on the track. I only had about an hour before the race to get this done.
I was stumped.
I just finished building an inelegant VI that simply sorts using a big case statement, but I hate it, and if I had to expand it to four lanes I might give up programming altogether.
So, I challange you, my dear LabView Gurus, to come up with either an elegant solution (that isn't all spegittie and select balls) to the simple three lanes, or a procedural system that could sort through an arbitrary number of lanes and assign an appropirate string to each.
Best of luck
--Spud
Solved! Go to Solution.
04-17-2015 07:26 PM
Sorry.
You need to provide the VI that you have attempted.
04-17-2015 07:34 PM
Sorry, here is what I came up with. It works, but IMO isn't the best solution and would require lots of work to expand it to even 4 places.
04-17-2015 07:38 PM
Amazing introduction to a Homework Assignment. Go read your class notes, view the On-Line LabVIEW tutorials, and the obvious (and trivial) solution will come to you.
Bob Schor
P.S. -- if I am completely wrong in my assumptions, I apologize. But it really is trivial, so if you can't solve it, you would really benefit from viewing the tutorials.
04-17-2015 07:50 PM
Simply sorting an array of number is pretty trivial, but thats not what I'm doing, I need to look at that list, and make a second list based on the values of the first, effectively without moving any of the elements of the origional list. I've written bubble sort routines before, but this is a different animal.
04-17-2015 08:02 PM
@killerspud wrote:
Simply sorting an array of number is pretty trivial, but thats not what I'm doing, I need to look at that list, and make a second list based on the values of the first, effectively without moving any of the elements of the origional list. I've written bubble sort routines before, but this is a different animal.
I don't have access to LabVIEW at the moment.
I have no idea what you mean you have to create a second list. Doesn't make sense.
04-17-2015 08:14 PM
@nyc_(is_out_of_here) wrote:
I don't have access to LabVIEW at the moment.
I have no idea what you mean you have to create a second list. Doesn't make sense.
So, I would give the VI an array of DBL numbers (time in seconds) and you must build an array of strings that contain "first" "second" "third" etc. corresponding to the first array.
04-17-2015 08:39 PM
04-17-2015 08:55 PM
@StevenD wrote:
Excelent, you just had the two arrays you made backwards. Use the sorted array (unindexed) as the array input for the search VI, and use the indexed unsorted array as the search term. Even with that simple error, my hat is off to you sir!
04-17-2015 11:59 PM
@killerspud wrote:
Excelent, you just had the two arrays you made backwards.
Are you sure about that?