expression that changes if a condition is true

조회 수: 3 (최근 30일)
Valeria Leto
Valeria Leto 2020년 5월 15일
댓글: Ameer Hamza 2020년 5월 15일
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)
  댓글 수: 2
Valeria Leto
Valeria Leto 2020년 5월 15일
thanks
Ameer Hamza
Ameer Hamza 2020년 5월 15일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (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