I wonder if there’s a simpler and nicer solution to toggle a variable between two values instead of (sure I can write a m-function but somehow I have the feeling there’s something built-in in matlab, but I couldn’t find it when googling for matlab toggle)
if(x == 0)
x = 1;
else
x = 0;
end
thanks
Maybe just
x = 1 - xwould suffice ?