cumfirstNot

Syntax

cumfirstNot(X, [k])

Please see cumFunctions for the parameters and windowing logic.

Details

Return the last element of X that is not k. If k is unspecified, return the last non-NULL element.

Examples

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

cumfirstNot(x, 1)
// output
[,,2,2,2,2,2,2]

m=matrix(1 2 3 NULL 4, NULL NULL 8 8 9);
m;
#0 #1
1
2
3 8
8
4 9
cumfirstNot(m);
#0 #1
1
1
1 8
1 8
1 8

Related function: firstNot