error in while command

조회 수: 4 (최근 30일)
Mudasir Ahmed
Mudasir Ahmed 2015년 6월 17일
댓글: Mudasir Ahmed 2015년 6월 17일
hi
i want to run following loop till conditions are met. but unfortunately when i execute the program then following error occurs. even line of error is also not mention where error exist. kindly help me.
while sqrt(((target(1,1)-p(1,1)).^2)+((target(1,2)-p(1,2)).^2))>0.1
"Subscript indices must either be real positive integers or logicals."
  댓글 수: 1
Mischa Kim
Mischa Kim 2015년 6월 17일
Please attach the entire code.

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

채택된 답변

Walter Roberson
Walter Roberson 2015년 6월 17일
That could happen if you accidentally defined a variable named "sqrt".
Another common problem is using "i" (lower-case I) as a subscript in a location where "i" has not been assigned a numeric value. "i" is pre-defined as sqrt(-1) so you do not get a message about "i" being undefined if you do that. "j" has exactly the same issue.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by