logo for matrixlab-examples.com
[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Matrixmania Blog
Contact
-> Sitemap <-
Matlab Books
Quick Matlab Guide
Matlab Tutorials
Matlab Examples
Matlab Flow Control
Boolean Algebra
Linear Algebra
Matlab 2D Plots
Matlab 3D Plots
Matlab GUI
Matlab Cookbook I
Matlab Cookbook II
Probability and Stats
Forums and Help
Relevant Links
Fun!
Your own Website?
Terms/Policies
leftimage for matrixlab-examples.com

Logical NOT


A    ~A
0      1
1      0

In MATLAB, ~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 A contains a zero value element at that same array location.  Otherwise, that element is set to 0.



Example:
If matrix A is:
A =

     0     0     1     1
     1     1     0     0
     0     0     0     0
     1     1     1     1

Then, the NOT A is produced:

>> ~A

ans =

     1     1     0     0
     0     0     1     1
     1     1     1     1
     0     0     0     0

>>



Example:
If vector x is:
x =

     0     1     2    -3     0

Then, the NOT x is produced:
>> ~x

ans =

     1     0     0     0     1

>>

From 'Logical NOT' to home
From 'Logical NOT' to 'Boolean Algebra'

footer for logical not page