当前位置: 动力学知识库 > 问答 > 编程问答 >

matlab - Obtaining the index of the largest element of an array without also obtaining the value

问题描述:

I understand that [M,I] = max(A) will get for me the value of the largest element in the array and also its index.

Is there a convenient way to obtain the index without also (unnecessarily, from my perspective) also obtaining the value?

Ideally I'd like to be able to do this so that I can just write index = function(A).

网友答案:

You can always put a ~ for any return you don't want, so, in your case, you'd have [~,index] = max(A).

分享给朋友:
您可能感兴趣的文章:
随机阅读: