fork download
  1. function I = sorti(A)
  2. [~, I] = sort(A);
  3. end
  4. f = @(A) sorti(sorti(A)) - 1;
  5. g = @(A) [A;f(A)];
  6. g([1 100 10 10000 1000])
  7. g([3 1 4 1 5 9 2])
  8. g([0 1 0 1 0 1 0 1])
Success #stdin #stdout 0.12s 46500KB
stdin
Standard input is empty
stdout
ans =

       1     100      10   10000    1000
       0       2       1       4       3

ans =

   3   1   4   1   5   9   2
   3   0   4   1   5   6   2

ans =

   0   1   0   1   0   1   0   1
   0   4   1   5   2   6   3   7