LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Challange: Determine first second and third places given three DBLs.

Solved!
Go to solution

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

0 Kudos
Message 1 of 13
(3,188 Views)

Sorry.

 

You need to provide the VI that you have attempted.

 

 

0 Kudos
Message 2 of 13
(3,184 Views)

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. 

0 Kudos
Message 3 of 13
(3,178 Views)

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.

0 Kudos
Message 4 of 13
(3,173 Views)

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.

0 Kudos
Message 5 of 13
(3,165 Views)

@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.

0 Kudos
Message 6 of 13
(3,144 Views)

@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.

0 Kudos
Message 7 of 13
(3,140 Views)
Solution
Accepted by topic author killerspud

Who won.PNG

Message 8 of 13
(3,133 Views)

@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!

0 Kudos
Message 9 of 13
(3,122 Views)

@killerspud wrote:
Excelent, you just had the two arrays you made backwards.

 

Are you sure about that?

0 Kudos
Message 10 of 13
(3,078 Views)