Index in position 2 exceeds array bounds. Index must not exceed 7?
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Rik
on 17 Nov 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!