I want to calculate the CA based on 2 options: JP0. I used the if......else statement, but it does not work. In fact, I want different outputs from a change in one input as you can see in my code:

----------------------------------

Jp=x data; Jd=y data;

JP= diff(Jp);JD= diff(Jd);

if JP>0

CA=atan(JD./JP)*(180/3.14);

else

CA=atan(JD./JP)*((180/3.14)+180);

end

-----------------------------------

I appreciate any help.

Similar questions and discussions