how to correct subscript indices error in following codes?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
a=0.85;
for i=1:7
filename=strcat('D:\2nd year\EXP season 2\Dry\cat1\',num2str(i),'.bmp');
I=imread(filename);
I1=I(:,:,2);
I2=I(:,:,3);
G_Channel_cat1(i-2)=mean(mean(I1(293+(-5:5),285+(-5:5))))-mean(mean(I2(293+(-5:5),285+(-5:5))))*a;
end
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 19 Nov. 2012
When i is 1, i-2 is going to be -1, and you cannot store into element number -1 of G_Channel_cat1.
It is not obvious what you are trying to do in that assignment statement, so I cannot suggest any fix other than not subtracting 2 from "i" at that point.
4 Kommentare
satish thapaliya
am 20 Nov. 2012
Bearbeitet: Walter Roberson
am 20 Nov. 2012
Walter Roberson
am 20 Nov. 2012
Your first "for" loop assigns to G_Channel_cat1 which has an upper-case C. All your other variables use a lower-case C there.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Entering Commands 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!