MATLAB: How i can calculate the average of the top numbers

average

i have 20 numbers , i need to calculate the average of the top 8 scores , how i can do it using matlab

Best Answer

If A is your vector
b=sort(A,'descend')
out=mean(b(1:8))