Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Attempted to access d(1); index out of bounds because numel(d)=0.

1 回表示 (過去 30 日間)
halime çelik
halime çelik 2016 年 12 月 19 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
c=6;
for i=1:c;
d=find(sira(i,:)>0)
l=length(d);
TC=STC(1,d(1));
t=0;
T=0;
for j=1:(l-1)
t=CTC(d(j),d(j+1))
T=T+t;
end;
T=T+TC;
TT(1,i)=T;
end;
Topl=sum(TT);
error is at this line: TC=STC(1,d(1)); what is the reason ? and how can I solve this error. Could you help me ?
  1 件のコメント
José-Luis
José-Luis 2016 年 12 月 19 日
Have you tried using the debugger?
dbstop if error
The answer should then become obvious.

回答 (1 件)

Jan
Jan 2016 年 12 月 19 日
After the line
d = find(sira(i,:)>0)
d can be empty, if no element of this line is greater than 0. We cannot suggest a change in the code, because we cannot know what you want to happen in this case. But you can detect it by:
if isempty(d)
...

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by