Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is not equal represented by ~= in Matlab?

Tags:

matlab

This one of the things that has always bothered me about Matlab. I understand why arrays start at 1 and not at 0 like in any other programming language, but why is != ~= in Matlab?

like image 631
Ingo Avatar asked Oct 05 '10 15:10

Ingo


3 Answers

The tilde character (~) is generally used as the bitwise NOT operator.
As the ! character is reserved for an other usage (OS command), I guess it's not a bad choice.

like image 134
Macmade Avatar answered Sep 30 '22 19:09

Macmade


In mathematical logic ~ is an old-fashioned way to write ¬

like image 25
Jon Hanna Avatar answered Sep 30 '22 17:09

Jon Hanna


In logic tilde can mean "not", which may be confusing as in math tilde can be "equivalence" or "approx". However, it is found on more keyboards than the less ambiguous ¬. Watch out, as tilde can also mean bitwise not :)

like image 43
Marc Gravell Avatar answered Sep 30 '22 17:09

Marc Gravell