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 Related SolutionsMATLAB: Find mean of last five cells in cell array. You may convert your cell into double/ matrix and do what you want:load example.mat ;k = cell2mat(AMJ06sort) ;% pick last fiveiwant = k(end-5:end,:) ;Find the mean of iwant. doc mean to find the mean. MATLAB: Sort and assign ranking You can use the third return argument of unique(): Try this:X = [ 13 15 5 5 0 0 0 1 0 3] [sortedValue_X , X_Ranked] = sort(X,'descend')[uniqueValues, ia, ic]=unique(sortedValue_X)X_Ranked = max(ic)-ic+1 % <- there's your answer!In command window:X_Ranked = 1 2 3 3 4 5 6 6 6 6 Related QuestionCount numbers of identical rowsDraw a five starIf i have two of matrix how to sort themSum five elements before a specific number
Best Answer