Wraps X into the [-180 to 180] interval.
x: angle(s) in degrees (single value, vector or ND-matrix).
xwrap: output value(s) in the range [-180 .. 180] degrees. The interval [-180 .. 180] is a closed interval: values equal to negative odd multiples of -180 are mapped to -180, values equal to an odd multiple of 180 are mapped to 180.
wrapTo180 ([-181, -180, -50; 180, 200, 460]) ans = 179 -180 -50 180 -160 100
See also: unwrap, wrapToPi, wrapTo2Pi.
Package: mapping