03-17-2010 08:01 PM
Hi all,
I am new to LabView and have a question most of you may find simple. I am trying to collect torque signals from an isokinetic dynamometer and need to collect the 50 highest (max) values in the order in which they occur. I know how to find the maximum and minimum values, but need the highest 50. Thank you so much.
03-17-2010 08:29 PM
Intialize an array of 50 numbers of -Inf before your while loop. Take a value. Find the minimum of the array, if the new value is greater than that, then delete that minimum value from the array and build the new value onto the end of the array. If the new value is less than the minimum of the array, then it is not one of the 50 largest, so just pass through the array untouched.
Repeat forever.
03-17-2010 09:07 PM
03-17-2010 09:17 PM
Mine would maintain the order. I said the new value would be built onto the end of the array. The minimum value that would be the old 50th maximum would get deleted from the array. So any values after that would get moved up. You'd just have to use the index from the function to find the minimum in the array when you do the Delete from Array subset.
One question I would have of the OP that would affect the algorithm used is whether these values need to be acquired and processed one at a time, or if the analysis of the 50 biggest can occur after all data samples have been collected. My method would fit the former, your method would fit the latter.
03-17-2010 09:41 PM
03-17-2010 09:49 PM - edited 03-17-2010 09:50 PM