Find the position of a minimum in an array

17 views (last 30 days)
Hi there! I would like to find the position of a minimum in an array.Something like a=[ 3 4 2 6 0 9 ; 3 5 8 2 5 9] pos_min= [1,5]

Accepted Answer

Torsten
Torsten on 17 Oct 2018
Edited: Torsten on 17 Oct 2018
a=[ 3 4 2 6 0 9 ; 3 5 8 2 5 9];
[min_val,idx]=min(a(:));
[row,col]=ind2sub(size(a),idx)

More Answers (0)

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!