Page 1 of 1

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

Posted: Fri Dec 16, 2016 9:34 pm
by matlab1
tr

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

Posted: Wed Aug 26, 2020 3:38 am
by matlab1
This error happens in MATLAB, when the left side of an equation or command can not save the result of a command.

for example :


sum2 = 10
in3 = [2,3]
if( y = in3 )
sum_y = sum2 +1;
end

In the top m-file, there is error in the if-command.

The in3 variable is a matrix, but the y variable is a number, so this line of the program produces an error.

Solution :

sum2 = 10
in3 = [3]
if( y == in3 )

sum_y = sum2 +1;
end