n = length(a);newArray = zeros(n,1);for i=1:n [num,index] = max(a); newArray(i) = num; a(index) = [];end满足要求要求的话,望采纳。
a=[1 4 2 7 3 7 9 3 -3 23]b=sort(a);for i=1:length(a) b(i)end