How do I make a function that shows the minimum value and index of that original minimum value without the "min()" function?

조회 수: 3 (최근 30일)
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?

채택된 답변

dpb
dpb 2016년 3월 24일
[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?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by