First 5 minimum elements of a vector
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Bless
il 7 Feb 2013
Commentato: Amir Hosein Fardi
il 23 Nov 2021
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 Commenti
Risposta accettata
Azzi Abdelmalek
il 7 Feb 2013
Modificato: Azzi Abdelmalek
il 7 Feb 2013
vector=rand(10,1)
[x,idx]=sort(vector)
out_x=x(1:5) % 5 first values
out_idx=idx(1:5) % corresponding indices
1 Commento
Amir Hosein Fardi
il 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 .
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!