function [index_row, index_column] = find_line(xx, yy)
%Use mouse clicks to find the indices of co-ordinate arrays.
%function [index_row, index_column] = find_line(xx, yy)
%Given longitude and latitude arrays, xx and yy, find_line draws a grid
%with a world map over it.  The user can then click the mouse as many
%times as required - the process is terminated with a carriage return.
%find_line returns index_row and index_column.  These vectors contain
%the row and column indices of the co-ordinate points in xx and yy that
%are closest to the points clicked on with the mouse.

%     Copyright J. V. Mansbridge, CSIRO, Wed Jul 13 18:06:10 EST 1994

z = zeros(size(xx));
mesh(xx, yy, z)
view(2)
hold on
axis([nanrange(nanrange(xx)) nanrange(nanrange(yy))])
coast
hold off
[xi, yi] = ginput;
[index_row, index_column] = closest(xx, yy, xi, yi);
