MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 大家能帮我看一下这段程序有什么问题吗 (https://www.labfans.com/bbs/showthread.php?t=14352)

多多月 2012-03-03 21:29

大家能帮我看一下这段程序有什么问题吗
 
count=[4,1,3,6,1,2,5,7,1,2];
>> NIND=10;
for i=1:NIND
if count(i)==0 R2(i)=0;
else if 0<count(i)<=2 R2(i)=10000000;
else if 2<count(i)<=6 R2(i)=20000000;
else if 6<count(i)<=10 R2(i)=30000000;
else R2(i)=60000000;
end
end
end
end
end
运行结果总是是R2 =

Columns 1 through 8

10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000

Columns 9 through 10

10000000 10000000
我改变count的值,可结果还是一样的,哪位高手能告诉我问题出在哪里呀,先谢谢啦!

peterjim 2012-03-03 23:53

回复: 大家能帮我看一下这段程序有什么问题吗
 
count=[4,1,3,6,1,2,5,7,1,2];
NIND=10;
for i=1:NIND
if count(i)==0 R2(i)=0;
elseif count(i)>0&count(i)<=2 R2(i)=10000000;
elseif count(i)>2&count(i)<=6 R2(i)=20000000;
elseif count(i)>6&count(i)<=10 R2(i)=30000000;
else R2(i)=60000000;
end
end

duoduoyue 2012-03-04 19:48

回复: 大家能帮我看一下这段程序有什么问题吗
 
非常感谢,终于搞明白了

aiyaolei 2012-03-05 10:20

回复: 大家能帮我看一下这段程序有什么问题吗
 
MTALB 数学博士, 有什么需要帮助的, 加我 QQ:1790880773 youchang


所有时间均为北京时间。现在的时间是 06:24

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.