error in while command

1 vue (au cours des 30 derniers jours)
Mudasir Ahmed
Mudasir Ahmed le 17 Juin 2015
Commenté : Mudasir Ahmed le 17 Juin 2015
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 commentaire
Mischa Kim
Mischa Kim le 17 Juin 2015
Please attach the entire code.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 17 Juin 2015
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.
  1 commentaire
Mudasir Ahmed
Mudasir Ahmed le 17 Juin 2015
thanks sir

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by