how i can calculate the average of the top numbers

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

 Accepted Answer

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

4 Comments

my question is write a computer program that calculates the average of the top 8 numbers
You can find sorting routines on the internet, for example wikipedia. You can program that up yourself - I don't think you need us for that.

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!