expression that changes if a condition is true

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

采纳的回答

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

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by