I found the minimum element of vector by
[m index]=min(vector);
How to find first five minimum elements of a vector and its index??

댓글 수: 2

Jan
Jan 2013년 2월 7일
There is no minimum command in Matlab.
Bless
Bless 2013년 2월 7일
thanks, I wrongly typed for min...

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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 7일
편집: Azzi Abdelmalek 2013년 2월 7일

1 개 추천

vector=rand(10,1)
[x,idx]=sort(vector)
out_x=x(1:5) % 5 first values
out_idx=idx(1:5) % corresponding indices

댓글 수: 1

Amir Hosein Fardi
Amir Hosein Fardi 2021년 11월 23일
that was really helpful
after 5 yrs of matlab programming today I was thinking about it and I really got confused to find the proper way to do that .

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2013년 2월 7일

댓글:

2021년 11월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by