Use While loop for a matrix

조회 수: 1 (최근 30일)
Ayodele Ogunkoya
Ayodele Ogunkoya 2017년 12월 15일
댓글: Walter Roberson 2017년 12월 15일
I have a variable A with 517X519 size and variable B with 517X519. I will like to use a while loop. for example, I will like to do: while A > B. so that A goes through all the cells in B (268323) and check if condition are met. I get this error message
Warning: Rank deficient, rank = 1, tol = 3.035597e-12.
Matrix dimensions must agree.
Can some please assist.
  댓글 수: 3
Ayodele Ogunkoya
Ayodele Ogunkoya 2017년 12월 15일
Yes i want to compare the every element of A with all element of B
Walter Roberson
Walter Roberson 2017년 12월 15일
It sounds as if your code uses the / operator on matrices at some point. Either you are expecting only scalars at that point but have matrices (or vectors) instead, or else you know you are operating on matrices but should have used ./ instead of /

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by