Help me about my error on index in position 2 exceeds array bounds (must not exceed 800).
1 view (last 30 days)
Show older comments
after=before; %Inisialisasi matriks hasil untuk memuat tanda air
for i=1:rm %Sematkan watermark di mid-band
for j=1:cm
x=(i-1)*8;
y=(j-1)*8;
if mark(i,j)==1
k=k1;
else
k=k2;
end;
after(x+1,y+8)=before(x+1,y+8)+alpha*k(1);
after(x+2,y+7)=before(x+2,y+7)+alpha*k(2);
after(x+3,y+6)=before(x+3,y+6)+alpha*k(3);
after(x+4,y+5)=before(x+4,y+5)+alpha*k(4);
after(x+5,y+4)=before(x+5,y+4)+alpha*k(5);
after(x+6,y+3)=before(x+6,y+3)+alpha*k(6);
after(x+7,y+2)=before(x+7,y+2)+alpha*k(7);
after(x+8,y+1)=before(x+8,y+1)+alpha*k(8);
end;
end;
2 Comments
Walter Roberson
on 22 Dec 2019
My guess is that (cm-1)*8+8 == 8*cm exceeds the number of columns in before .
But that is only a guess, as we do not know the size(before) or what the values of rm or cm are.
TADA
on 22 Dec 2019
look here
always copy the entire error message, and tell us from which line of code it originated
moreover, in general, sample data would go a long way
Answers (1)
TADA
on 22 Dec 2019
I have no idea what rm and cm are, but at some iteration
y=(j-1)*8 + 8
is greater than the number of columns in your matrix
under the editor menu, you have the run button, if you expand the run menu you can check the "pause on errors"
to easily debug this error
0 Comments
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!