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

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

Answers (1)

if f <= -8 || f >= 8
error('f is outside the valid range')
end
Alternative:
if abs(f) >= 8

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Release

R2022a

Asked:

on 8 May 2022

Edited:

Jan
on 8 May 2022

Community Treasure Hunt

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

Start Hunting!