expression that changes if a condition is true

3 Ansichten (letzte 30 Tage)
Valeria Leto
Valeria Leto am 15 Mai 2020
Kommentiert: Ameer Hamza am 15 Mai 2020
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!

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by