fork download
  1. function v = f(v)
  2. v(mod(v, 2) == 1) = sort(v(mod(v, 2) == 1));
  3. end
  4. f([6 5 4 3 2 1]), f([6 5 3 1])
Success #stdin #stdout 0.06s 45320KB
stdin
Standard input is empty
stdout
ans =

   6   1   4   3   2   5

ans =

   6   1   3   5