  1.  NAME

  regrid2 - Regrid two dimensional data

  2.  SYNOPSIS

  [new, grid] = regrid2(data, x, y, grid, method )

  3.  DESCRIPTION

  This Matlab function removes lfirst ines that contain bad data along
  the specified x and y axes. It generates then x- andy-grid points from
  the input data, and averages duplicate values at identical grid
  points. If grid is not specified, x- and y-grids are generated from
  the x- and y-values in the input data. Data are then interpolated on
  the new grid points.

  Input data do not need to be sorted and may contain bad values, or
  duplicate values at identical points.

  4.  PARAMETERS

     data
        Array containing two dimensional data in xyz-.

     x  Column numbers specifying the x-axis.

     y  Column numbers specifying the y-axis.

     grid optional
        A cell array of two column vectors specifying the new grid
        points,where x=grid{1},and y=grid{2}. If not present,a default
        regular grid is build,starting and ending at the same points as
        the given axes,and with the same number of points.

     method optional
        The interpolation method to use for regridding data (default is
        linear). See Matlab help on function griddata for more
        information.

  5.  RETURNS

     new
        An Y*X*V mesh where the values of index v correspond to the
        columns in the input array.

     grid optional
        A cell array with two column vectors containing the values of
        the new grid points,where  x=grid{1} and y=grid{2}.

  6.  AUTHORS

  Pierre Jaccard, Geophysical Institute, University of Bergen, 1999

