Compute pixel centers for georeferenced image or data grid
[x,y] = pixcenters(R, height, width)
[x,y] = pixcenters(r,sizea)
[x,y] = pixcenters(..., 'makegrid')
[x,y] = pixcenters(R, height, width) returns the spatial coordinates of a spatially-referenced image or regular gridded data set. R is either a 3-by-2 referencing matrix defining a 2-dimensional affine transformation from intrinsic pixel coordinates to map coordinates, or a map.rasterref.MapRasterReference object. height and width are the image dimensions. If r does not include a rotation (i.e., r(1,1) = r(2,2) = 0), then x is a 1-by-width vector and y is a 1-by-height vector. In this case, the spatial coordinates of the pixel in row row and column col are given by x(col), y(row). Otherwise, x and y are each a height-by-width matrix such that x(col,row), y(col,row) are the coordinates of the pixel with subscripts (row,col).
[x,y] = pixcenters(info) accepts a scalar struct array with the fields
3-by-2 referencing matrix
[Z,R] = arcgridread('MtWashington-ft.grd'); [x,y] = pixcenters(R, size(Z)); h = surf(x,y,Z); axis equal; demcmap(Z) set(h,'EdgeColor','none') xlabel('x (easting in meters)') ylabel('y (northing in meters') zlabel('elevation in feet')