Find the 10 (or X) highest values of an array

 

Hello,

I have an array with 4000 values and would like to find the 10 (or X) highest values in that array, not just the highest. I am really not sure how I would go about that. Can anyone help please?


Thanks.

 

You can use function:

int ArraySort( double&array[], int count=WHOLE_ARRAY, int start=0, int sort_dir=MODE_ASCEND) 

with last argument (sort_dir) set to MODE_DESCEND. The array will then have the 10 highest values in the range 0..9, that is, array[0] is the highest, array[1] is the next highest and so on....


A.M.

 
Thanks guys, I did know about the ArrayMaximum() function but that would only return the highest value within the whole array, not the 10 highest descending. But I didn´t know about eh ArraySort() function, now thanks for that and that is exactly what I was looking for!! Perfect:)
Reason: