logical data type represents
using the numbers
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.
|Logical operations with short-circuiting|
|Find logical AND|
|Find logical NOT|
|Find logical OR|
|Find logical exclusive-OR|
|Determine if all array elements are nonzero or true|
|Determine if any array elements are nonzero|
|Logical 0 (false)|
|Find indices and values of nonzero elements|
|Determine if input is logical array|
|Convert numeric values to logicals|
|Logical 1 (true)|
This example shows how to filter the elements of an array by applying conditions to the array.
This example shows how to use the
all functions to reduce an entire array to a single logical value.
Precedence rules determine the order in which MATLAB evaluates an expression.
This reference table shows the results of applying
the binary logical operators to a series of logical
Determine whether an array is logical by testing the entire array or each element individually.