all(C(:))
Compare elements of two matrices
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!