MATLAB: Evaluating matrix in if statement

matrices

How can i get an if statement to evaluate a truth condition based on a matrix, such that
tol = [.0001;.0001;.0001;.0001;.0001;.0001;.0001;.0001;.0001;.0001]
difference_force = [10;10;10;10;10;10;10;10;10;10]
difference_displacement = [10;10;10;10;10;10;10;10;10;10]
if (difference_force > tol) == ones(1,10)' && (difference_displacement > tol)
without getting "Operands to the and && operators must be convertible to logical scalar values." error

Best Answer

if all(difference_force > tol) && all(difference_displacement > tol)