MATLAB: Find something strange when using rot90. the matrix are not equal nor equal. In this case 33 appears in the answer.

if statementrot90

A=randi(2,3,3);
B=rot90(A);
if A==B
11
elseif A~=B
22
else
33
end

Best Answer

An evaluated expression is true when the result is nonempty and contains all nonzero elements (logical or real numeric). Otherwise, the expression is false.
The A==B is not true because there is at least one element that does not match. The A=~B is not true because there is at least one element that does match. So you get the third possibility.