expression that changes if a condition is true

1 view (last 30 days)
Hi! I know it's a silly question but I don't remember how to write an expression like that
theta=psi+pi*(condition:x<0)
and I want -theta=psi if the condition is false
-theta=psi+pi if the condition is true
thanks!

Accepted Answer

Ameer Hamza
Ameer Hamza on 15 May 2020
This is the correct syntax
theta = psi+pi*(x<0)

More Answers (0)

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!