Find indicies of k smallest matrix elements
Show older comments
I'm trying to find the indicies of smallest k matrix elements.
For example if I have
A = [10 5 2; 34 5 21; 4 6 8];
and I want to find the smallest 2 elements indicies then I want indicies 7 and 3.
Accepted Answer
More Answers (1)
Sindar
on 29 Sep 2020
[~,idx] = mink(A,2);
3 Comments
madhan ravi
on 29 Sep 2020
The reason is because the OP was using older version of MATLAB, in case you were wondering.
Brady Dean
on 29 Sep 2020
madhan ravi
on 29 Sep 2020
Unfortunately not everyone has the Crystal Ball.
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!