Index in position 2 exceeds array bounds. Index must not exceed 7?

3 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Rik
Rik am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by