Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to express 0- 1 variable in MATLAB
How to express 0- 1 variable in MATLAB
In matlab, two variables can be directly defined to represent 0 and 1 respectively. For example:

Fake? =? 0; ? //? Define a dummy variable, which represents 0.

Really =? 1; ? //? Define a dummy variable, which represents 0.

Answer? =? 3;

What if? ! Answer? ==? Fake//? If the negation of a is not equal to 0 (false), a=0 is executed.

Answer? =? 0;

The ending variable can be used directly in matlab without definition.