error occuring

1 次查看(过去 30 天)
prem preet
prem preet 2011-10-22
if (N_red = 3) & (difference_red<0.1)
unlike_red = 0.5
??? if (N_red = 3) & (difference_red<0.1) | Error: The expression to the left of the equals sign is not a valid target for an assignment.
can anyone suggest it plsss as soon as possible
  1 个评论
Jan
Jan 2011-10-22
"plsss as soon as possible" is not helpful in this forum. It does not sound polite, but pushy. In addition there is a high correlation between the appearence of "plzzz" and the "no_attempt" and "doit4me" tag, which are both desasterous.
If you want to be polite, accept an answer which solves the problem and thank the auther in the comment section. Just as a suggestion.

请先登录,再进行评论。

回答(2 个)

Grzegorz Knor
Grzegorz Knor 2011-10-22
Should be:
if (N_red == 3) & (difference_red<0.1)
  3 个评论
Jan
Jan 2011-10-22
And my MLint has copied IA's recommendation also.
Grzegorz Knor
Grzegorz Knor 2011-10-22
You are right.

请先登录,再进行评论。


Jan
Jan 2011-10-22
Description of the problem:
N_red = 3
This assigns the value 3 to the variable N_red. But in an IF-condition you want to compare, such that the == operator is required.

类别

Help CenterFile Exchange 中查找有关 Historical Contests 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by