How to find least 8 values in a 1xN row matrix with their positions?
Show older comments
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'
Accepted Answer
More Answers (1)
Thorsten
on 20 Oct 2015
[~, ind] = sort(A);
B = ind(1:8)
1 Comment
Y L V SANTOSH KUMAR
on 20 Oct 2015
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!