!

Logical "not" operator.

Syntax

!expr

Operands

expr
A valid scalar, vector, or matrix expression.

Example

Expression Result
!1 0
!0 1
!{1, 0, 2} {0, 1, 0}
!{ {1, 0}, {0, 1} } { {0, 1}, {1, 0} }

Comments

If expr is a scalar, and is nonzero, the result is zero. If the value of expr is zero, the result is one.

If expr is a vector or matrix, the result is a vector or matrix with the same dimensions as expr. If an element of expr is nonzero, the corresponding element of the result is zero. If an element of expr is zero, the corresponding element of the result is one.