MATLAB: Compare elements of two matrices

MATLABmatrix element comparision

The necessary condition for my "while" loop to keep running is that not all elements of matrix B are smaller than those of matrix A, that is, for the loop to stop it must be true that:
B(i,j) < A(i,j)
for all i and all j. I can compare the two matrices like
C = (B < A)
and get a matrix with 0 and 1 elements, but then the problem converts to checking whether all elements of the matrix C are 1 or not. Is there a way to solve this without using for loops inside the while loop to compare the elements one by one?
Thank you in advance and sorry for my English.

Best Answer

all(C(:))