MATLAB: Secons max number in a vector secons max number in a vector Hi I need to find maximum and second maximum number in a vector. Can you please help? For max, its max(X), but for second max I am unable to figure out. Your help is appreciated P Best Answer a = max(X); Y = X(X ~= a); b = max(Y); Related SolutionsMATLAB: How to find matrix indices Do you want the single biggest element in the matrix? If so then, just max() will not give you that. You'll get a row vector of the largest elements in each column. X = [1.2 1.3;1.8 1.5]; [val,idx] = max(X(:)); [I,J] = ind2sub(size(X),idx);X(I,J)is the largest element. MATLAB: Max value Better to use the capabilities of MAX, than to use FIND and a comparison.[mx,I] = max(x); % mx is the maximum value, I is the location. Related QuestionHow do i find the max value of xvecDetect row and columnProblems with min and max functionsFind a Maximum in a MatrixSimple operation with vectors
Best Answer