Index in position 2 exceeds array bounds. Index must not exceed 7?
3 次查看(过去 30 天)
显示 更早的评论
When I run my program some times work and alot of times got this message and I dont know why:
Index in position 2 exceeds array bounds. Index must not exceed 7.
Error in
N1(1,i)=f(n-j,i+j);
my code is :
N1=f(n,:);
for i=1:size(f,1)
if isnan(N1(1,i))
for j=1:size(f,1)
N1(1,i)=f(n-j,i+j);
if ~isnan(f(n-j,i+j))
break
end
end
end
end
0 个评论
采纳的回答
Rik
2022-11-17
Since i and j both range from 1 to the number of rows in f, there is no reason i+j will be less than the number of columns in f.
Since you wrote no comments and didn't use understandable variable names, I cannot provide you with a suggestion for a fix.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!