how to switch the value of a boolean.

99 views (last 30 days)
Hi, is there any function to do the following :
a = true;
b = someFunction(a)
==> b = false
b = sumeFunction(b)
==> b = true;
thank you.

Accepted Answer

Honglei Chen
Honglei Chen on 7 Sep 2012
Edited: Honglei Chen on 7 Sep 2012
b = ~a;
c = ~b;
or if you are looking for the functional form
b = not(a);
c = not(b);

More Answers (1)

James Tursa
James Tursa on 7 Sep 2012
b = ~a;
c = ~b;

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!