How to find least 8 values in a 1xN row matrix with their positions?
Mostrar comentarios más antiguos
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'
Respuesta aceptada
Más respuestas (1)
Thorsten
el 20 de Oct. de 2015
[~, ind] = sort(A);
B = ind(1:8)
1 comentario
Y L V SANTOSH KUMAR
el 20 de Oct. de 2015
Categorías
Más información sobre Shifting and Sorting Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!