标签: matlab
如何获取1D数组的最小n元素
n
示例
A = [29, 60, 96, 43, 69, 53]; n=3; %so B will be like this B = [29 43 53];
答案 0 :(得分:4)
试试这个:
B = sort(A); %# sort in ascending order B = B(1:n); %# take the first N-values