[TOC]
eq
Element-wise comparison (equal) of arrays
Usage
eq(A, B)
A and B should have compatible sizes.
- If the inputs have different but compatible sizes, one of the inputs will be expanded to match the size of the other input. In particular, if one of the inputs is a scalar, it compares this scalar with each element of the other input.
- An element of the output is assigned logical
1 if the corresponding elements of A and B are equal, is assigned logical 0 if otherwise.
- If
A or B is complex, it compares both real and imaginary parts.
- It gives the same result as
A == B.
Example
- Comparing a scalar to each element of an array.
eq([1 2 3;-2 2 4], 2)
Output
ans =
0 1 0
0 1 0