Filter löschen
Filter löschen

Indexing Exceeds number of array elements

2 Ansichten (letzte 30 Tage)
Muhammad Amir Javed
Muhammad Amir Javed am 28 Feb. 2023
Beantwortet: Image Analyst am 28 Feb. 2023
et=4; dn1=1:61;
for ii=length(dn1)
r(ii)=(et+((dn1(ii+1)-dn1(ii))))./((dn1(ii)-(dn1(ii-1)))+et);
end
Index exceeds the number of array elements. Index must not exceed 61.

Akzeptierte Antwort

Image Analyst
Image Analyst am 28 Feb. 2023
Look at your indexes - they go from ii-1 to ii+1 so ii can only go from 2 to length(dn)-1
et=4;
dn1=1:61;
for ii = 2 : length(dn1)-1
r(ii) = (et+((dn1(ii+1)-dn1(ii))))./((dn1(ii)-(dn1(ii-1)))+et);
end

Weitere Antworten (0)

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by