How to find least 8 values in a 1xN row matrix with their positions?
Afficher commentaires plus anciens
I have a row matrix with 94 elements, Ex: A=rand(1,94). Now i would like to find the least 8 values in the matrix 'A' with their positions & I would like to form a matrix with the 'position numbers' of least 8 values in matrix 'A'.
I used "[value,position]=min(A)", by using this i could find one least value and its position stored in value and position respectively. But i want 8 least values and their respective positions. Finally, i would like to form a row matrix (1 X 8) with position numbers of least 8 values of matrix 'A'
Réponse acceptée
Plus de réponses (1)
Thorsten
le 20 Oct 2015
[~, ind] = sort(A);
B = ind(1:8)
1 commentaire
Y L V SANTOSH KUMAR
le 20 Oct 2015
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!