Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I don't what is wrong with this coding..Pls help me identify

4 ビュー (過去 30 日間)
Janet
Janet 2012 年 2 月 29 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I want to give signals in polar form...First I create random data and then use If condition to change it to polar form
len=128;
m=4;
msg1=randint(len,1,m);
msg2=randint(len,1,m);
if msg1(1,1)=0
polar_data=-1;
else
polar data=1;
end
if msg2(1,1)=0
polar_data2=-1;
else
polar data2=1;
end
  1 件のコメント
Janet
Janet 2012 年 2 月 29 日
Error:The expression to the left of the equals sign is not a valid target for an assignment.

回答 (1 件)

the cyclist
the cyclist 2012 年 2 月 29 日
In your if statements you need to use the symbol "==" rather than "=" to check equality.
There are a couple other errors in your code. For example, you have the line
polar data=1;
which I think you meant to be
polar_data=1;
Below, I fixed up a couple of those:
len=128;
m=4;
msg1=randint(len,1,m);
msg2=randint(len,1,m);
if msg1(1,1)==0
polar_data=-1;
else
polar_data=1;
end
if msg2(1,1)==0
polar_data2=-1;
else
polardata2=1;
end
  4 件のコメント
Janet
Janet 2012 年 2 月 29 日
pls anyone help me to use for loop
Srinivas
Srinivas 2012 年 2 月 29 日
just do avoid confusion I deleted my previous comments.
@sana, you can use 'for' loop and link below should help
http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by