no sir Walter. My problem now is I can embed the data that had embedded and retrieve it in one sub-block only. But it cant continuously proceed to the next sub-block to continue embed and retrieve the data.

Matt, because i'm done on image watermarking apply spatial domain method. As you know, the 2*2 block size are used to embed the one ASCII binary data(for my research purpose). So my problem now cant proceed to the next block while after my first data had been embed and retrieved.

display('EMBED');
for b=1:1:size_char
n=1;
for r=1:2
for c=1:2
block(r,c)=bitset(block(r,c),1,embed(n));
n=n+1;
block(r,c)=bitset(block(r,c),2,embed(n));
n=n+1;
end
end
if (x2+blocksize) > (N_RONI+startx-1)
if y2+blocksize < (M_RONI+starty)
x2=startx;
y2=y2+blocksize;
end
else
x2=x2+blocksize;
end
watermarked_image(y2:y2+blocksize-1,x2:x2+blocksize-1)=block;
end

I just showed you. There are two for loops. See where it says row = 1 : windowSize : rows-windowSize? Well that means that the first time it executes the code in the for loop row will have a value of 1, and same for col. Let's say that windowSize = 2 by 2. so that means thisBlock will get the chunk of the window from 1,1 to 2,2: thisBlock = yourImage(1:2, 1:2); You can't get all of 1,1 to 3,3 with a window size of 2 - you'd need a window size of 3 rather than 2. Now if you want to have the next row be 4, you'd have to jump by the window size plus 1. 1+4 = 4, so you need to jump by 3 which is 2+1 which is the window size plus 1. And you'd be skipping row 3 entirely. William William, have you really though about the coordinates? And you want a different "jump" size that is different than the window size?

excuse me. My variable n got problem. leave it outside for loop it will get the latest data while put into the for loop will get the first data. How can i embed it therefore it can follow the sequence of embedding from first to the last?