What does this do?
Show older comments
I can't figure out what this bit of code is doing:
[m,n]=find(min(a))
I know that it is not returning the indices of the minimum entries in the array 'a', but what is it doing?
Accepted Answer
More Answers (1)
Walter Roberson
on 17 Jul 2016
0 votes
If a is a 2D or more array, then min(a) would return the minimum along the first dimension. Some of those minima might be negative, some might be positive, some might be 0. find() applied to that is going to return the indices of the non-zero elements within that minima. For example if a is 2D array then [m,n]=find(min(a)) is going to return the indices of the columns where the minima is non-zero.
Categories
Find more on Operators and Elementary Operations 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!