f = @(v) reshape([v(mod(v, 2) == 0); sort(v(mod(v, 2) == 1))], 1, []);f([6 5 4 3 2 1])
Standard input is empty
ans = 6 1 4 3 2 5
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!