function C = cotomat(x,y)
% C = cotomat(x,y)
% converts a set of grid coordinates in vectors x and y
% into a single matrix [x(1) y(1); x(1) y(2);...;x(1) y(rx);
% x(2) y(1); x(2) y(2);...;x(2) y(ry);...; x(r) y(1); 
% x(rx) y(2);...; x(rx) y(ry)] where rx and ry are the 
% lengths of x and y
% Written by Gerry Middleton, October 1996
rx = length(x);
ry = length(y);
k = 1;
for i = 1:rx
  for j = 1:ry
     C(k,1) = x(i);
     C(k,2) = y(j);
     k = k + 1;
  end
end
