简体   繁体   English

如何使MATLAB在矩阵的每一列中显示最小值的行索引?

[英]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 = 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 = 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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