Compare elements of two matrices

2 visualizaciones (últimos 30 días)
László Arany
László Arany el 13 de Feb. de 2012
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.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 13 de Feb. de 2012

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by