error occuring

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 日

0 投票

Should be:
if (N_red == 3) & (difference_red<0.1)

3 件のコメント

Image Analyst
Image Analyst 2011 年 10 月 22 日
I'd probably use && instead of &.
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 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

タグ

タグが未入力です。

質問済み:

2011 年 10 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by