MATLAB: Finding the mean value for five maximum number in matrix

homeworksignal & image processing

Hi guys, I have (1*9) matrix below, I 'd like to calculate mean value for max 5 number in this matrix can anyone help me?
Regards

Best Answer

This works:
x = [20 19 1 20 21 22 4 2 1];
xs = sort(x,'descend');
max5mean = mean(xs(1:5))
produces:
max5mean =
20.4