Borrar filtros
Borrar filtros

expression that changes if a condition is true

3 visualizaciones (últimos 30 días)
Valeria Leto
Valeria Leto el 15 de Mayo de 2020
Comentada: Ameer Hamza el 15 de Mayo de 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!

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 15 de Mayo de 2020
This is the correct syntax
theta = psi+pi*(x<0)
  2 comentarios
Valeria Leto
Valeria Leto el 15 de Mayo de 2020
thanks
Ameer Hamza
Ameer Hamza el 15 de Mayo de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by