|
"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fpfnvr$4k9$1@fred.mathworks.com>...
> well, I tried to generalize my problem. Here's a more
> detailed description...I hope it explains what im trying do to:
>
> My aim is to create a m-by-n binary coastline image from a
> set of coordinates.
>
> Therefore I have:
>
> LatArray, m-by-n, containing the Latitudes for each pixel
> LonArray, m-by-n, containing the Longitudes for each pixel
> m and n = 101
>
> LatVector, q-by-1
> LonVector, q-by-1
> q is about 10000
>
> The coordinates given by Lat/LonVector need to be found
> within Lat/LonArray, even if the values given do not
> perfectly match the values stored in the arrays. I will need
> the subscripts/linear index of the array elements that
> matched the vector coordinates.
>
> Finally a new m-n blank image is created and a pixel is set
> to 1, if it contains a coord. of the vector...
>
> Right now I'm using a for loop to compute the euclidean
> distance from each element of Lon/Lat-Vector to the
> coordinates given in the arrays and then use the row/column
> with the minimal distance for setting the pixel.
So you have a scattered set of data, with
roughly 10000 points in it, and a regular
grid.
You want to "snap" these grid points to the
regular grid? What will you do with them?
It sounds like you wish to use nearest
neighbor interpolation, predicting the value
of the function at the regular grid points
from your data. Is this correct? If so, then
it is available from griddata directly.
John
|