In Scilab, here is a straightforward solution, provided that c
's first column is already sorted:
i = [c(2:$,1)~=c(1:$-1,1) ; %T];
tmp = [0 ; cumsum(c,"r")(i, 2)];
res = [c(i,1), tmp(2:$)-tmp(1:$-1)]
yielding
--> res = [c(i,1), tmp(2:$)-tmp(1:$-1)]
res = [3x2 double]
11. 4.
12. 5.
13. 23.