OK, when I cut and pasted your version, I didn't notice you changed my 1:2 to 2:2. So, it should be ...
>> b=zeros(8,2);
for i=1:4;
b(2*i-1:2*i,1:2)=[1 0;1 0];
end
I get the feeling you dont understand the syntax and the logic behind what we are doing here. You need to understand what 1:2 means in the matrix specification. The 1:2 means we start at column 1 and end at column 2. So, b(1:4,7:9) would be a sub-matrix made from rows 1, 2, 3 and 4 and from columns 7, 8 and 9.