Compare elements of two matrices

1 view (last 30 days)
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.

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 13 Feb 2012

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!