MATLAB: How to extract two equal maximum values at different index different lndexMATLAB Hi guys, How can I point out the different location of two maximum values example A = [8,5,6,7,8] If i type [max_A, index] = max(A), it will give me max = 8 and index = 1, but in this case the index must be 1 and 5. Best Answer index=find(A==max(A))This should give you the indexes. Related SolutionsMATLAB: How to know the indices of multiple max values One way:A = [4 5 9 9];maxval = max(A);lia = ismember(A,maxval);idx = find(lia);or shortermaxval = max(A);idx = find(A == maxval); MATLAB: Point at which max occurs It is always a good idea to read the doc for any such question:doc maxdocsearch('maximum value')The two output call to the MAX function gives you what you need.[maxval,index] = max([1 5 6 7 8 9 10 12 2 7 8 11 5]) Related QuestionEqual CellHow to look for minimum value in a vector from backwardsEquals numbers returns not equalHow to locate the index of the maximum value in a given range
Best Answer