How do i break a loop at set values to NaN

13 ビュー (過去 30 日間)
william Smith
william Smith 2019 年 4 月 5 日
編集済み: per isakson 2019 年 4 月 6 日
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 Center および File ExchangeLoops 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