【matlab】Error: The expression to the left of the equals sign

问题描述:

【matlab】Error: The expression to the left of the equals sign is not a valid target for an
matlab 中我编辑的语句后出现了这个提示,请打手帮忙分析下Error: The expression to the left of the equals sign is not a valid target for an
assignment.
>> for n=1:10
for m=1:2^(n-1)
for p=1:2^(n-2)
a=zeros(n,m); if m=2p-1 a(n,m)=a(n-1,(m+1)/2)+(4/9)^n;else;a(n,m)=a(n,m-1)+4^(n-2)/9^(n-1);
end
end
end
end
b=sort(a);
1个回答 分类:综合 2014-11-23

问题解答:

我来补答
报错的原因是你的if 语句里边写错了,应该是 == ,而不是=
等你改完了,就会报另外一个错误,因为你a的下标取到0了.所以你得再看看你这个算法流程对不对,是不是应该设一个初始值.
 
 
展开全文阅读
剩余:2000