简体   繁体   中英

How to get MATLAB to display the row index of the minimum value in every column of a matrix?

I have am matrix like this:

S =

2.2100   16.0100
0.0100    9.8100
9.4100    0.0100

Now I want to know the row number of the minimum value in every column. The vector I'm looking for should look like that:

D =

 2
 3

Thank you for your help.

[val, ind] = min (S)

and you will have the value:

val =

   0.010000   0.010000

ind =

   2   3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM