Contents Previous Next Subchapters

Determining if Any Elements are True
Syntax y = any(x)
y = any(xd)
See Also Mlmode , all

Description
Determines if any of the elements of x are true where x is a logical matrix.

If d is not present, y is a logical scalar that is true if any of the elements of x are true.

If the argument d is the integer one, y is a logical row vector with the same column dimension as x. The j-th element of the y is true, if any of the elements in the j-th column of x are true.

If the argument d is the integer two, y is a logical column vector with the same row dimension as x. The i-th element of the y is true, if any of the elements in the i-th roe of x are true.

Example
If you enter
     x = [ 0 2 0; 4 5 0 ]
     any(x)
O-Matrix will respond
     T
If you continue
     any(x, 1)
O-Matrix will respond
     [ T , T , F ]
If you continue
     any(x, 2)
O-Matrix will respond
     {
     T
     T
     }