【matlab】Error: The expression to the left of the equals sign is not a valid target for anmatlab 中我编辑的语句后出现了这个提示,请打手帮忙分析下Error: The expression to the left of the equals sign is not a valid target for a

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 03:17:13
【matlab】Error: The expression to the left of the equals sign is not a valid target for anmatlab 中我编辑的语句后出现了这个提示,请打手帮忙分析下Error: The expression to the left of the equals sign is not a valid target for a

【matlab】Error: The expression to the left of the equals sign is not a valid target for anmatlab 中我编辑的语句后出现了这个提示,请打手帮忙分析下Error: The expression to the left of the equals sign is not a valid target for a
【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);

【matlab】Error: The expression to the left of the equals sign is not a valid target for anmatlab 中我编辑的语句后出现了这个提示,请打手帮忙分析下Error: The expression to the left of the equals sign is not a valid target for a
报错的原因是你的if 语句里边写错了,应该是 == ,而不是=
等你改完了,就会报另外一个错误,因为你a的下标取到0了.所以你得再看看你这个算法流程对不对,是不是应该设一个初始值.