MATLAB: Are there any functions to randomly pick the minimum element from a vector if the vector has multiple minimum elements

MATLABmin

Function min() picks the first minimum element from a vector if the vector has multiple minimum elements.
I want to randomly pick the minimum element from all the minimum elements and get its value and index.
Could you tell me if there is a function to do that?

Best Answer

No, there is no function provided for that. You can write such a function, though. The difficulty of doing it will depend upon whether you are working with a vector or something that is at least 2D (in which case it has to process per row or per column)