Search code examples
matlabsymbolsarithmetic-expressions

What does the tilde symbol after an equals do?


What does the tilde symbol ~ do in Matlab?

for example, I've got the Matlab line, in which a and b are tables.

a =~b;

Solution

  • Basically a is assigned to the result of the logical not operator applied to b

    For example if b is the matrix

    b = [12 0 10]
    

    then

    a = ~b 
    a = [0 1 0]
    

    See http://www.mathworks.co.uk/help/matlab/ref/not.html for details