Is there a vacuum cleaner (like in, ideally built-in, I never used Matlab so I apologize if I missed something obvious) to make the k-smallest argmin in Matlab (ie if the array is [4,5,6 , 7], it should return the indices 1,2 in this order), except for such things as:
arr = [4,5,6,7]; [~, argmin1] = min(arr); arr(argmin1) = Inf; [~, argmin2] = min(arr); ...
source share