Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How do I fix: Index exceeds array bounds.
1 回表示 (過去 30 日間)
古いコメントを表示
j= 1:length(index_aanname);
for j= 1:length(index_aanname)
for l=1:length(alldata)
if ((strcmp(alldata(l,3), SA{j})) && ((TA(1,j) - alldata{l,1}) <= 10.0) && ((TA(1,j) - alldata{l,1}) >= 0) && (strcmp(alldata(l,4), 'Voor'))) == 1
eerste_kijkmoment(l) = tijdnum(l);
j=j+1;
end
end
end
j goes up to 240. I know that in the loop it goes to 241, that's why there is an error. But how do I fix this? I know it ask more often over here, but I cannot come to an answer...
2 件のコメント
Majid Farzaneh
2018 年 6 月 10 日
Hi,
Why you are using j=j+1?
What is the size of SA and TA?
Error occurs because of j=j+1. It cause increasing of j exceed SA or TA size.
回答 (1 件)
Star Strider
2018 年 6 月 10 日
If you want to increment ‘j’ inside the ‘l’ loop, the easiuest way is to reverse the order of the for calls:
for l = 1:length(alldata)
for j = 1:length(index_aanname)
... CODE ...
end
end
2 件のコメント
Star Strider
2018 年 6 月 10 日
I have no idea how to interpret your ‘SA’ and ‘TA’ data, or even what they mean or what you want to do with them.
I cannot help you further.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!