A bit of background first...
I'm using an Arduino Uno to measure a square wave output from a speed sensor. My current plan (it's not running yet) is to measure a number of instantaneous (lets say 50-odd) values and then process the results to return a single "speed". I'll fine-tune the duration and filtering once I have seen how stable the sensor output is but for now I've set up a filter that removes all values that are not within 20% of the arithmetic mean. I would rather use a filter that first disregards the top 10% and bottom 10% (by value) of the data and then averages the remaining 80% however and I'm not sure of the most efficient way to do that.
I think I could setup a nested loop to reorder all of the values numerically but I was hoping there was a more direct way to do that. Is there a way I can find the rank of a value within an array for instance?