From: marco mantovani on
Hi,
i wrote an M file. It works, but has some problems. To work them out I tried with an easier version of the problem so that I can understand where things start going wrong.

The new program is identical to the first but for the parameters and other minor stuff.
But now I get an assignment error for this part (related to n_plus):

%compute neighborhoods
n_plus=zeros(T);
for i=1:T-1
g_r=G(:,(i-1)*3+1:(i-1)*3+3);
for j=i+1:T %i+N(i)
g_c=G(:,(j-1)*4+1:(j-1)*4+4);
dif_g=g_c-g_r;
if sum(sum(abs(dif_g)))==2
n_plus(i,j)=1;
end;
end;
end;

The strange thing is that if I tape
n_plus=zeros(T);
in the command window, it works!
Can somebody help me?
Thanks
Marco