any

any(X) returns true if any of vector's X elements are non zero.
If X is a matrix a logical row vector is returned with the i-th element indicating whether any of X i-th column elements are non zero or not.

any(X,dim) allows specifying dimension along which to test.

Examples

> any([0 0 2])

	[ans:true]
> any([0 0 0])

	[ans:false]
> any([1 2 0; 2 2 0; 1 0 0])#

	1 1 0
> any([1 2 0; 2 2 0; 1 0 0],2)#

	1
	1
	1

Resources

See also

all | prod | sum