Transform geographic to discrete coordinates
Jare the row and column subscripts of the raster cells (or image pixels)
Jrefer to the nearest sample point (posting)
Find Indices of Nearest Posting Point from Geographic Coordinates
Import elevation data  for a region in Colorado as an array and a
GeographicPostingsReference object. Find the indices of the posting point nearest to the latitude and longitude of South Boulder Peak, which are
-105.2992 degrees, respectively.
[Z,R] = readgeoraster('n39_w106_3arc_v2.dt1'); [I,J] = geographicToDiscrete(R,39.9539,-105.2992)
I = 56
J = 842
The result means that the posting point closest to the geographic coordinates is in row 56 and column 842 of the array.
 The elevation data used in this example is from the U.S. Geological Survey.
lat — Latitude coordinates
Latitude coordinates, specified as a numeric array.