expression that changes if a condition is true

3 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by