フィルターのクリア

Help me about my error on index in position 2 exceeds array bounds (must not exceed 800).

1 回表示 (過去 30 日間)
Jajang Khairil Azhar
Jajang Khairil Azhar 2019 年 12 月 22 日
回答済み: TADA 2019 年 12 月 22 日
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 件のコメント
Walter Roberson
Walter Roberson 2019 年 12 月 22 日
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
TADA 2019 年 12 月 22 日
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

サインインしてコメントする。

回答 (1 件)

TADA
TADA 2019 年 12 月 22 日
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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by