%% Array flow control 
% Demonstrate how logical work with arrays
clear;
A = [1 2 3]; 
B = A;
C = [1 2 2];

if (A==B)
  fprintf('A==B\n');
end

if (A==C) 
  fprintf('A==C\n');
elseif (A~=C) 
  fprintf('A~=C\n');
else 
  fprintf('~(A==C) && ~(A~=C) !?\n');
end

%% Explanation
% When the expression in an if statement is not a scalar, Matlab treats
% it as true only if all elements of the array are true.  
