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 Kommentare

Jan
Jan am 7 Feb. 2013
There is no minimum command in Matlab.
Bless
Bless am 7 Feb. 2013
thanks, I wrongly typed for min...

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 7 Feb. 2013
Bearbeitet: Azzi Abdelmalek am 7 Feb. 2013

1 Stimme

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

1 Kommentar

Amir Hosein Fardi
Amir Hosein Fardi am 23 Nov. 2021
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 .

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by