【问题标题】:Find column index of minimum value from 2D arrays从二维数组中查找最小值的列索引
【发布时间】:2014-04-15 12:40:54
【问题描述】:

假设我有一个这样的二维数组:

Array = [1 2 3; 5 1 6; 4 3 2]

我想找到每行之间的最小值,并且 保存该结果的列索引。 我希望我的答案是这样的:

ans = [1; 1; 2]

和索引:

column_index = [1; 2; 3]

有人可以帮帮我吗?谢谢。

【问题讨论】:

    标签: arrays matlab indexing


    【解决方案1】:

    您正在寻找沿第二个维度的最小值。使用min -

    [minval,column_index] = min(Array,[],2)
    

    【讨论】:

      猜你喜欢
      • 2014-03-05
      • 2018-07-05
      • 2019-07-05
      • 2017-05-22
      • 2015-04-06
      • 2015-10-11
      • 1970-01-01
      • 2019-03-31
      • 2015-07-22
      相关资源
      最近更新 更多