The expression to the left of the equals sign is not a valid target for an assignment.function final=disjkstra(A,x,y)% A = adjacency matrix of the graph(includes point x and y)% x = intial node % y = terminal node A(A= =0)=NaN;IN=x;s=zeros(1,Length(A

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/04 07:08:04
The expression to the left of the equals sign is not a valid target for an assignment.function final=disjkstra(A,x,y)% A = adjacency matrix of the graph(includes point x and y)% x = intial node % y = terminal node A(A= =0)=NaN;IN=x;s=zeros(1,Length(A

The expression to the left of the equals sign is not a valid target for an assignment.function final=disjkstra(A,x,y)% A = adjacency matrix of the graph(includes point x and y)% x = intial node % y = terminal node A(A= =0)=NaN;IN=x;s=zeros(1,Length(A
The expression to the left of the equals sign is not a valid target for an assignment.
function final=disjkstra(A,x,y)
% A = adjacency matrix of the graph(includes point x and y)
% x = intial node
% y = terminal node
A(A= =0)=NaN;IN=x;s=zeros(1,Length(A));
d=zeros(1,Length(A));d(x)=0;
for z=1:Length(A)
if~isWithin(IN,z)
d(z)=A(x,z);s(z)=x;
end
end
while~isWithin(IN,y)
tempMin=[];
for z=1:Length(A)
if~isWithin(IN,z)
tempMin=[tempMin,d(z)];
end
end
p=min(tempMin);search=find(d= =p);
for i=1:Length(search)
search=find(d= =p);
if(~isWithin(IN,search(i)))
p=search(i);break;
end
end
IN=[IN,p];
for z=1:Lnegth(A)
if~isWithin(IN,z)
oldDistance=d(z);
d(z)=min(d(z),d(p)+A(p,z));
if~(d(z)= =oldDistance)
s(z)=p;
end
end
end
end
final=y;z=y;
while (z= =x)= =0
final=[final,s(z)];z=s(z);
end
final=fliplr(final);
function truth = isWithin(source,search)
truth=0;
for i= 1:Length(source)
if(suorce(i)= =search)
truth=1;
end
程序是这个 但是老是出现The expression to the left of the equals sign is not a valid target for an assignment,到底哪里错误了呢?

The expression to the left of the equals sign is not a valid target for an assignment.function final=disjkstra(A,x,y)% A = adjacency matrix of the graph(includes point x and y)% x = intial node % y = terminal node A(A= =0)=NaN;IN=x;s=zeros(1,Length(A
表达式等号左边的表达式不是一个有效的赋值目标