Basically I have an if/else statement to ensure a given value obtain from cosine and sine is between -180 and +180.
In other words, if the value ends up being 270-deg, I want it to be -90-deg instead.
I set up an if/else statement as follows, where phi2a comes from a value from a function.
phi2b = 180-phi2a;
if phi2b > 180
phi2b = phi2b-360;
When I do this, however, whenever phi2b is greater than 180, it still produces a value greater than 180.
I tried to do a sample code (below) to see if the syntax is correct, but this one ended up working when I change the value of A:
A = 1;
if A > 10
A = A+5;
So if A=1, then it outputs 1. If A = 20, it outputs 25. This is how I want the other if/else to function.
I can show more of my code if need be.
Basically the phi2a is a vector running from 1 to N, where N is 4393. I then plot either phi1a, phi1b, phi2a, or phi2b (Not all of which is shown here), based on another if/else statement. I can show this code as well if it'll help.
If this is confusing please let me know so I can add more information.
Any help is appreciated. Thanks.
Edit: I've added a snippet of my whole code in case that helps.