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?

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

= 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/

=========

For example, this

x<0 && y = 0;

should really be this

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

1. Less Than Or Equal To "=" Sign becomes Equal "=" sign.

3. please explain the the function to left of equals sign

4. If cell is left blank, or equals zero, then cell equals a different cell

5. How do I only get valid "answers" in a VLOOKUP function (no #N/A's

6. If cell is left blank, or equals zero, then cell equals a diff

7. If cell is left blank, or equals zero, then cell equals a differen

8. Why a plus sign after the equal sign?

9. CountIF(A9:A20, B9 not equal B10, B10 not equal B11, etc.)

10. automatic equal sign that is NOT WANTED

11. Hyperlinks ending in "=" do not highlight/include the ending equal sign

12. variable not equal to expression

13. gvim regular expression search for not equal

14. How do I type in a "not equal to" sign in Microsoft Word?

15. "Target of signal assignment is not a signal"

4 post • Page:**1** of **1**