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

조회 수: 12 (최근 30일)
aditya sahu
aditya sahu 2017년 9월 13일
댓글: Image Analyst 2017년 9월 13일
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
KL
KL 2017년 9월 13일
Just google or search in matlab documentation.
in the command line,
doc min

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2017년 9월 13일
doc min
k = [12,13,16,10,17,9,19,45] ;
[val,idx] = min(k)
  댓글 수: 3
aditya sahu
aditya sahu 2017년 9월 13일
편집: aditya sahu 2017년 9월 13일
I got it ...[val,idx] = min(k(1:2))..Thank you dear @ KSSV...HAVE A WONDERFUL DAY/NIGHT.
Image Analyst
Image Analyst 2017년 9월 13일
You can "thank" him by "accepting" and voting for his answer so he gets reputation credits for his answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by