ilastNot
Syntax
ilastNot(X)
Arguments
X is a vector, or a tuple of vectors of equal length, or a matrix.
Details
If X is a vector, return the subscript of the last non-Null element. Return -1 if all elements are Null.
If X is a tuple of vectors, return the subscript of the last position where the element in all vectors is not Null.
If X is a matrix, return the subscript of the last non-Null element within each column. The result is a vector.
Examples
$ ilastNot(NULL NULL 2 4 8 1 NULL);
5
$ ilastNot(take(int(),5));
-1
$ x=NULL NULL 4 7 8 NULL
$ y=1 NULL NULL 4 NULL NULL
$ ilastNot([x,y]);
3
$ x=NULL NULL 4 7 8 NULL
$ y=1 2 NULL NULL NULL 6
$ ilastNot([x,y]);
-1
$ m=matrix(2 NULL 1 0 NULL, NULL 2 NULL 6 0);
$ m;
#0 |
#1 |
---|---|
2 |
|
2 |
|
1 |
|
0 |
6 |
0 |
$ ilastNot(m);
[3,4]