How do i break a loop at set values to NaN

13 vues (au cours des 30 derniers jours)
william Smith
william Smith le 5 Avr 2019
Modifié(e) : per isakson le 6 Avr 2019
I need to break a loop when i reach values if alpha<-pi or apha>pi and set values for alpha and x(direction) to NaN, this is not working, please adivse
if alpha(i)<(-pi)||alpha(i)>(pi)
break
x(i+1:end)=NaN;
alpha(i+1:end)=NaN;
end

Réponse acceptée

per isakson
per isakson le 6 Avr 2019
Try
if alpha(i)<(-pi)||alpha(i)>(pi)
x(i+1:end)=NaN;
alpha(i+1:end)=NaN;
break
end

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by