It looks like you did all the hard fixes already. I think what you want is:
conf=ones(103,1);
f=conf;
for k=1:102 % <--- reduced this because otherwise f(k:k+1) attempts to
% index beyond the size of f
f(k:k+1)=1i;
conf=f.*conf;
p(k,:)=conf;
end
p(103,:)=1i;
I would check the results for a smaller array. For instance if I run the following smaller version of the above (as a test)
conf=ones(5,1);
f=conf;
for k=1:4
f(k:k+1)=1i;
conf=f.*conf;
p(k,:)=conf;
end
p(5,:)=1i;
I get
>> real(p)
ans =
0 0 1 1 1
-1 -1 0 1 1
0 0 -1 0 1
1 1 0 -1 0
0 0 0 0 0
and
>> imag(p)
ans =
1 1 0 0 0
0 0 1 0 0
-1 -1 0 1 0
0 0 -1 0 1
1 1 1 1 1