MATLAB: How to make a function that shows the minimum value and index of that original minimum value without the “min()” function

functionsminimum value

Im trying to create a function that will take four numbers and return the minimum vanlue and the index that shows which parameter it was, the only catch is Im not allowed to use the "min()" function. Any ideas out there?

Best Answer

[minx,idx]=mynotverycleverhomeworkminfunction(x)
[s,is]=sort(x);
minx=s(1);
idx=is(1);
More to the point, what have you done so far and where, specifically, did you get stuck by Matlab?
Related Question