MATLAB: Checking if a matrix is symmetric

matrixsymmetric

Hi
i want to check if the matrix is symmetric or not by using nested loops and display a certain message if it is or not. the problem is that it's displaying the message after comparing each element of the original matrix with the ones in the transposed or inversed matrix.. i want the message to be displayed after both matrices are compared!.
A = [ 2 6 9; 7 3 8; 10 11 12];
for i = 1:3
for j = 1:3
if(A(i,j) == A(j,i))
disp('true')
else
disp('false')
end
end
end

Best Answer

disp(isequal(A,A.'))