MATLAB: Is there a command ( like “sort” for example ) arranges vector elements ascending ,max, descending (humped shap)

commandMATLAB

Is there a command ( like "sort" for example ) arranges vector elements ascending ,max, descending (humped shap)?

Best Answer

>> V = randi(99,1,23)
V =
93 68 76 74 39 65 17 70 4 28 5 10 82 69 32 95 4 44 38 76 79 19 49
>> Y = sort(V);
>> Z = [Y(1:2:end),fliplr(Y(2:2:end))]
Z =
4 5 17 28 38 44 65 69 74 76 82 95 93 79 76 70 68 49 39 32 19 10 4