matlab and or
MATLAB represents Boolean data using the logical data type. This data type represents true and false states using the numbers 1 and 0, respectively.
Example 1: 14-MATLAB的運算元/logical01.m. a = [1 2 0 3 4 2 0]; b = [0 2 3 5 4 0 0]; andResult = a & b % AND 運算orResult = a | b MATLAB程式設計:入門篇.
You can use Logical OR with | to find index of some specific number. The symbols | and || perform different operations in a MATLAB® application.
In MATLAB, | and || are both logical operators that are used to perform logical OR operations on Boolean variables, however,
A | B performs a logical OR of inputs A and B and returns an array or a table containing elements set to either logical 1 ( true ) or logical 0 ( false ).
MATLAB offers two types of logical operators and functions − Element-wise logical operators operate element-by-element on logical arrays.
A | B represents the logical OR. A | B is true when either A or B is true, or when both A and B are true.