如何在MATLAB中获得1D数组中"n个最小元素"的索引?
该数组是行向量.
我可以找到最小元素及其索引;
[C, ind] = min(featureDist);
Run Code Online (Sandbox Code Playgroud)
矢量如下:
featureDist =
Columns 1 through 8
48.4766 47.3743 59.5736 59.7450 55.0489 58.2620 63.3865 50.1101
Run Code Online (Sandbox Code Playgroud)
等等...
我正在使用Matlab的内置排序功能:
[temp, Idx] = sort(M,2);
Run Code Online (Sandbox Code Playgroud)
我想得到M的每一行的排序索引,这是一个大小> 50k的矩阵.
我努力搜索但没有找到任何东西..如果您有任何意见,将不胜感激!