MATLAB Answers

How to find the position of smallest element in an array.

72 views (last 30 days)
aditya sahu
aditya sahu on 13 Sep 2017
Commented: Image Analyst on 13 Sep 2017
Suppose there is an array called 'x' which contains elements such as, [12,13,16,10,17,9,19,45]. How to find the position of the smallest element of the array. Here the smallest element is '9' and its position is 6.(Can it have a solution for this with out using 'function' and using the function both.
  1 Comment
KL
KL on 13 Sep 2017
Just google or search in matlab documentation.
in the command line,
doc min

Sign in to comment.

Accepted Answer

KSSV
KSSV on 13 Sep 2017
doc min
k = [12,13,16,10,17,9,19,45] ;
[val,idx] = min(k)
  3 Comments
Image Analyst
Image Analyst on 13 Sep 2017
You can "thank" him by "accepting" and voting for his answer so he gets reputation credits for his answer.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by