How do i break a loop at set values to NaN

5 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by