The expression to the left of the equals sign is not a valid target for an assignment.

The expression to the left of the equals sign is not a valid target for an assignment.

My code is:
(starts with a if statment):
.....
elseif x<0 && y = 0;
d=pi;
disp(d)
elseif x=0 & y>0;
d= pi/2;
disp(d)
elseif x=0 & y<0;
d=-pi/2;
disp(d)
elseif x= 0 & y=0;
d=0;
disp(d)
end

the issue? It keeps underlining the equal signs in the code and tells me "The expression to the left of the equals sign is not a valid target for an assignment."
can someone tell me whats wrong with it?

The expression to the left of the equals sign is not a valid target for an assignment.

A single '=' is an assignment as in a = 0, you just set a to equal 0. '==' is a test, is a equal to 0?

The expression to the left of the equals sign is not a valid target for an assignment.

= is the assignment operator. To test for equality, use ==
You might want to read the Getting Started with MATLAB documentation. In
your case, you may also want to switch your & operators with && assuming x
and y are always scalar values.

--
Loren
http://www.yqcomputer.com/
http://www.yqcomputer.com/

The expression to the left of the equals sign is not a valid target for an assignment.

=========

For example, this

x<0 && y = 0;

should really be this

x<0 && y == 0; %Note the '=='