not - Find logical NOT of array or scalar input

Syntax

~A
not(A)

Description

~A performs a logical NOT of input array A, and returns an array containing elements set to either logical 1 (true) or logical 0 (false). An element of the output array is set to 1 if the input array contains a zero value element at that same array location. Otherwise, that element is set to 0.

The input of the expression can be an array or can be a scalar value. If the input is an array, then the output is an array of the same dimensions. If the input is scalar, then the output is scalar.

not(A) is called for the syntax ~A when A is an object.

Example

If matrix A is

     0    29     0    36     0
    23    34    35     0    39
     0    24    31    27     0
     0    29     0     0    34

then

~A
ans =
     1     0     1     0     1
     0     0     0     1     0
     1     0     0     0     1
     1     0     1     1     0

See Also

bitcmp, and, or, xor, any, all, Logical Operators, Logical Classes, Bit-Wise Functions

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS