

for (k = 1 : K)
   that = ind(k); 
   Ineighba{k} = I{that}; 
   Symneighba{k} = -Asym{that}; 
end

bx =0; by = 0; cc = 3;
col = 6; row = floor(K/col)+1;
Iout = zeros(row*sx+(row-1)*(2*bx+cc), 2*col*sy+(col-1)*(2*by+cc))+255; 
towrite = -sym; 
towrite = (255 * (towrite-min(towrite(:)))/(max(towrite(:))-min(towrite(:))));
Iout(1:sx, 1:sy) = towrite;
k = -1;  
for (r = 1 : row)
    for (c = 1 : col)
        k = k+1; 
        if ((k>=1)&&(k<=K))
            towrite = Ineighba{k}; 
            towrite = (255 * (towrite-min(towrite(:)))/(max(towrite(:))-min(towrite(:))));
            Iout((r-1)*sx+1+(r-1)*(2*bx+cc): r*sx+(r-1)*(2*bx+cc), (c-1)*2*sy+1+(c-1)*(2*by+cc): (c-1)*2*sy+sy+(c-1)*(2*by+cc)) = towrite; 
            towrite =  Symneighba{k}; 
            towrite = (255 * (towrite-min(towrite(:)))/(max(towrite(:))-min(towrite(:))));
            Iout((r-1)*sx+1+(r-1)*(2*bx+cc) : r*sx+(r-1)*(2*bx+cc), (c-1)*2*sy+sy+(c-1)*(2*by+cc)+1 : (c-1)*2*sy+sy+(c-1)*(2*by+cc)+sy) =towrite;  
        end
    end
end
for (r = 1 : row-1)
  Iout(r*sx+(r-1)*(2*bx+cc)+bx+1:r*sx+(r-1)*(2*bx+cc)+bx+cc, :) = 0; 
end
for (c = 1 : col-1)
  Iout(:, c*(sy*2)+(c-1)*(2*by+cc)+by+1:c*(sy*2)+(c-1)*(2*by+cc)+by+cc) = 0; 
end
outepsgif(Iout, ['ex9_1_' num2str(this)]); 

