cumcount

Details

Cumulatively calculate the number of non-NULL elements in X.

Examples

x=[1,2,NULL,3,4,NULL,5,6]
cumcount(x);
// output
[1,2,2,3,4,4,5,6]

m=matrix(1 2 3 NULL 4, 5 6 NULL NULL 8);
m;
#0 #1
1 5
2 6
3
4 8
cumcount(m);
#0 #1
1 1
2 2
3 2
3 2
4 3