24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 676  |  回复: 2

ldoop

主管区长

优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!


[求助] matlab 程序问题

各位大虾们帮忙看段程序,每次运行总是出现这样的错误:
Improper assignment with rectangular empty matrix.

Error in improved2 (line 56)
                         c(z)=find(divergentsp==b(z));
此时的值 b=4, c=[]
请问怎么调试,另外如何简化这段程序?万分感谢

源程序如下:
if abundance(species)==1
             if species~=S
                 b=find(divergentsp==species);
                 if isempty(b)~= 1
                     divergentsp(b)=b(1)-1;
                     divergentsp(b(1))=divergentsp(species);
                     for z=1:length(b)
                         c(z)=find(divergentsp==b(z));
                         divergentsp(divergentsp==b(z))=divergentsp(divergentsp==b(z))-1;
                         if isempty(c(z))~=1
                             for x=1:length(c(z))
                                 d(x)=find(divergentsp==c(x));
                                 divergentsp(divergentsp==c(x))=divergentsp(divergentsp==c(x))-1;
                                 if isempty(d(x))~=1
                                     for y=1:length(d(x))
                                         e(y)=find(divergentsp==d(y));
                                         divergentsp(divergentsp==d(y))=divergentsp(divergentsp==d(y))-1;
                                         if isempty(e(y))~=1
                                             for w=1:length(e(y))
                                                 f(w)=find(divergentsp==e(w));
                                                 divergentsp(divergentsp==e(w))=divergentsp(divergentsp==e(w))-1;
                                                 if isempty(f(w))~=1
                                                     g(u)=find(divergentsp(divergentsp==f(u)));
                                                     divergentsp(divergentsp==f(u))=divergentsp(divergentsp==f(u))-1;
                                                     if isempty(g(u))~=1
                                                         for q=1:length(g(u))
                                                             h(q)=find(divergentsp(divergentsp==g(q)))
                                                             divergentsp(divergentsp==g(q))=divergentsp(divergentsp==g(q))-1;
                                                             if isempty(h(q))~=1
                                                                 for l=1:length(h(q))
                                                                     divergentsp(divergentsp==h(l))=divergentsp(divergentsp==h(l))-1;
                                                                 end
                                                             end
                                                         end
                                                     end
                                                 end
                                             end
                                         end
                                     end
                                 end
                             end
                         end
                     end
                 end
             end
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

emanlee

管理员

优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!

【答案】应助回帖


感谢参与,应助指数 +1
jjdg: 金币+1, 感谢参与 2012-03-21 01:42:44
你的程序我放到matlab中,编译说至少缺了一个end,我加上end之后。
再编译,Undefined function or variable 'species'. 该程序不完整不好调试。

如果要调试,可以设置断点,然后,一句一句运行程序。
2楼2012-03-20 18:13:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Love_Matrix

实习版主

优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!优秀!!有木有!!!

【答案】应助回帖


感谢参与,应助指数 +1
jjdg: 金币+1, 感谢参与 2012-03-21 01:42:55
复制的把,需要15个end,少两个
3楼2012-03-20 21:21:16
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 ldoop 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料调剂 +10 Eujd1 2026-03-31 11/550 2026-04-01 11:23 by ivanqyq
[考研] 311求调剂一志愿合肥工业大学 +13 秋二十二 2026-03-30 13/650 2026-04-01 10:56 by oooqiao
[考研] 085600,321分求调剂 +12 大馋小子 2026-03-31 12/600 2026-04-01 10:52 by chemCH
[考研] 08工科275求调剂,可跨考。 +3 AaAa7420 2026-03-31 3/150 2026-04-01 09:27 by JourneyLucky
[考研] 349求调剂 +6 zwjjjjjj 2026-03-31 6/300 2026-04-01 09:16 by JourneyLucky
[考研] 352分-085602-一志愿985 +6 海纳百川Ly 2026-03-29 6/300 2026-03-31 21:06 by yuq
[考研] 复试调剂 +7 双马尾痞老板2 2026-03-31 7/350 2026-03-31 19:49 by Dyhoer
[考研] 一志愿武汉理工,总分321,英一数二,求老师收留。 +12 nnnnnnn5 2026-03-25 12/600 2026-03-31 16:21 by 记事本2026
[考研] 266分,求材料冶金能源化工等调剂 +8 哇呼哼呼哼 2026-03-27 10/500 2026-03-31 13:35 by Huaxue_Wang
[考研] 调剂310 +13 温柔的晚安 2026-03-25 14/700 2026-03-31 13:03 by 记事本2026
[考研] 一志愿食品科学与工程083200求调剂 +4 XQTJZ 2026-03-30 4/200 2026-03-31 04:10 by fmesaito
[考研] 328求调剂 +8 嗯滴的基本都 2026-03-27 8/400 2026-03-30 17:20 by Wang200018
[考研] 291求调剂 +5 Y-cap 2026-03-29 6/300 2026-03-29 13:18 by mumin1990
[考研] 086000生物与医药调剂 +5 Feisty。 2026-03-28 9/450 2026-03-29 12:02 by longlotian
[考研] 085600,专业课化工原理,321分求调剂 +5 大馋小子 2026-03-28 5/250 2026-03-29 08:56 by qingfeng258
[考研] 283求调剂 +3 A child 2026-03-28 3/150 2026-03-28 15:41 by ms629
[考研] 070300化学求调剂 +4 起个名咋这么难 2026-03-27 4/200 2026-03-27 21:39 by 83503孙老师
[考研] 08开头275求调剂 +4 拉谁不重要 2026-03-26 4/200 2026-03-27 14:12 by Delta2012
[考研] 调剂 +3 李嘉图·S·路 2026-03-27 3/150 2026-03-27 11:19 by wangjy2002
[考研] 0703化学338求调剂! +6 Zuhui0306 2026-03-26 7/350 2026-03-27 10:35 by shangxh
信息提示
请填处理意见