How do I do an if greater than or less than for a if statement

11 ビュー (過去 30 日間)
Kaden Bauernfeind
Kaden Bauernfeind 2022 年 5 月 8 日
編集済み: Jan 2022 年 5 月 8 日
I need to do a question wehre it needs to be greater than or less than a certain limit.
This is specifically over g force so it needs to be greater tha -8g and less than 8g otherwise it displays a fail message

回答 (1 件)

Jan
Jan 2022 年 5 月 8 日
編集済み: Jan 2022 年 5 月 8 日
if f <= -8 || f >= 8
error('f is outside the valid range')
end
Alternative:
if abs(f) >= 8

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by