MATLAB: First 5 minimum elements of a vector minimum I found the minimum element of vector by [m index]=min(vector); How to find first five minimum elements of a vector and its index?? Best Answer vector=rand(10,1)[x,idx]=sort(vector)out_x=x(1:5) % 5 first valuesout_idx=idx(1:5) % corresponding indices Related SolutionsMATLAB: How to look for minimum value in a vector from backwards A = [5 6 4 1 1 1];A_min = min(A);idx = find(A == A_min,1,'last')Also[A_min,idx] = min(fliplr(A));idx = numel(A) - idx + 1 MATLAB: Finding the max maxvalue = max(x);positions = find(x == maxvalue);No loop needed Related QuestionMatlab MinimumSmallest n such that vector(n) < aHow to get the first five minimum number for a listI want to find in which row the minimum element is
Best Answer