Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获得n一维数组的最小元素
n
例子
A = [29, 60, 96, 43, 69, 53]; n=3; %so B will be like this B = [29 43 53];
尝试这个:
B = sort(A); %# sort in ascending order B = B(1:n); %# take the first N-values