matlab无限循环语句,[求助] 关于matlab无限循环的问题

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

各路大神,求助啊啊啊啊~

以下是我的代码:

n=0

for i=1:length(NAXLES)

if CODE(i)==0

n=n+1

GVM1(n)=GVM(i)

GC(n)=(A2_MASS(i)* A1_SPACE(i)+ A3_MASS(i)* A2_SPACE(i) + A4_MASS(i)* A3_SPACE(i) + A5_MASS(i)* A4_SPACE(i) + A6_MASS(i)* A5_SPACE(i) + A7_MASS(i)* A6_SPACE(i) + A8_MASS(i)* A7_SPACE(i) + A9_MASS(i)* A8_SPACE(i) + A10_MASS(i)* A9_SPACE(i))/( A1_MASS(i)+A2_MASS(i)+A3_MASS(i) +A4_MASS(i) +A5_MASS(i) +A6_MASS(i) +A7_MASS(i) +A8_MASS(i) +A9_MASS(i) +A10_MASS(i))

X(n)= abs(A1_MASS(i)* GC(n)) + abs(A2_MASS(i)* (GC(n)- A1_SPACE(i))) + abs(A3_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i))) + abs(A4_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i))) + abs(A5_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)-A3_SPACE(i) - A4_SPACE(i))) + abs(A6_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i))) + abs(A7_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i))) + abs(A8_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)- A7_SPACE(i))) + abs(A9_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)- A7_SPACE(i)- A8_SPACE(i))) + abs(A10_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)- A7_SPACE(i)- A8_SPACE(i)- A9_SPACE(i)))

Y(n)= A1_MASS(i)* GC(n) + A2_MASS(i)* (GC(n)- A1_SPACE(i)) + A3_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)) + A4_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i)) + A5_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)-A3_SPACE(i) - A4_SPACE(i)) + A6_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)) + A7_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)) + A8_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)- A7_SPACE(i)) + A9_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)- A7_SPACE(i)- A8_SPACE(i)) + A10_MASS(i)* (GC(n)- A1_SPACE(i)- A2_SPACE(i)- A3_SPACE(i) - A4_SPACE(i)- A5_SPACE(i)- A6_SPACE(i)- A7_SPACE(i)- A8_SPACE(i)- A9_SPACE(i))

TL(n)= A1_SPACE(i)+ A2_SPACE(i)+ A3_SPACE(i) + A4_SPACE(i)+ A5_SPACE(i)+ A6_SPACE(i)+ A7_SPACE(i)+ A8_SPACE(i)+ A9_SPACE(i)

Bm(n)=4/GVM(i)*X(n)-2*(NAXLES(i)-1)/( NAXLES(i)* GVM(i)* GVM(i)* TL(n))*Y(n)* Y(n)

end

end

p=polyfit(Bm,GVM1,2)

xx=linspace(min(Bm),max(Bm))

yy=polyval(p,xx)

plot(Bm,GVM1,'k+',xx,yy,'r')

做的是一个数据的计算并且对结果进行二次拟合,可是,我的电脑已经跑了一天了,还没有处理完所有的数据,楼主截图后发现,电脑内部处理的数据在前10万个数据内循环,就是不能继续读后面的数据。此代码楼主先用前100个数据试了一下,没有问题才开始跑的,但是数据一多就不对了。

楼主需要处理的数据同工有1亿多组,是数据溢出吗?可是楼主有用同样的数据源跑其他的代码,没有问题,而且结果出的特别快,大概1分钟不到吧。现在到底是个什么情况?跪求各位大神指点啊啊啊啊!

下面是楼主的截图:

4aa8017803792ad5d0f7fd7aee5beedb.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值