How do i break a loop at set values to NaN

13 Ansichten (letzte 30 Tage)
william Smith
william Smith am 5 Apr. 2019
Bearbeitet: per isakson am 6 Apr. 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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by