wang1234587
2013-06-04, 12:57
已知数据如下
qidian=4; zhongdian=3;
course =
1 2 0 4 1 0 0 0 1 0
been =
2 1
2 3
NaN NaN
1 4
5 1
NaN NaN
NaN NaN
NaN NaN
1 6
NaN NaN
我的程序代码如下
temppoint=zhongdian;
while 2
[m n]=find(been==temppoint);
tem=m;
for i2=tem;
if course(i2)~=0&course(i2)~=temppoint
xxx=been(i2,: );
newpoint=xxx(xxx~=temppoint);
st=[st newpoint];
break;
end
end
if newpoint==qidian
break;
end
temppoint=newpoint;
end
运行的时候是死循环,我检查了很多遍都没看出错误在哪里,求大神帮助!谢了
PS:我这个循环是用来从zhongdian出发,逐个搜索been,看他对应的course是否(既不等于0,也不等于temppoint),直到qidian
qidian=4; zhongdian=3;
course =
1 2 0 4 1 0 0 0 1 0
been =
2 1
2 3
NaN NaN
1 4
5 1
NaN NaN
NaN NaN
NaN NaN
1 6
NaN NaN
我的程序代码如下
temppoint=zhongdian;
while 2
[m n]=find(been==temppoint);
tem=m;
for i2=tem;
if course(i2)~=0&course(i2)~=temppoint
xxx=been(i2,: );
newpoint=xxx(xxx~=temppoint);
st=[st newpoint];
break;
end
end
if newpoint==qidian
break;
end
temppoint=newpoint;
end
运行的时候是死循环,我检查了很多遍都没看出错误在哪里,求大神帮助!谢了
PS:我这个循环是用来从zhongdian出发,逐个搜索been,看他对应的course是否(既不等于0,也不等于temppoint),直到qidian