Main Content

Logical (Boolean) Operations

True or false conditions

MATLAB® represents Boolean data using the logical data type. This data type represents true and false states using the numbers 1 and 0, respectively. Certain MATLAB functions and operators return logical values to indicate fulfillment of a condition. You can use those logical values to index into an array or execute conditional code. For more information, see how to Find Array Elements That Meet a Condition.

Fonctions

&Find logical AND
Short-Circuit &&Logical AND with short-circuiting
~Find logical NOT
|Find logical OR
Short-Circuit ||Logical OR with short-circuiting
xorFind logical exclusive-OR
allDetermine if all array elements are nonzero or true
anyDetermine if any array elements are nonzero
falseLogical 0 (false)
findRechercher des indices et des valeurs d’éléments non nuls
islogicalDetermine if input is logical array
logicalConvertir des valeurs numériques en expressions logiques
trueLogical 1 (true)

Rubriques