This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Display regular data grid as image


h = grid2image(...)


grid2image(Z,R) displays a regular data grid Z as an image. The image is displayed in unprojected form, with longitude as x and latitude as y, producing considerable distortion away from the Equator. Z can be M-by-N or M-by-N-by-3, and can contain double, uint8, or uint16 data. The grid is georeferenced to latitude-longitude by R, which can be a geographic raster reference object, a referencing vector, or a referencing matrix.

If R is a geographic raster reference object, its RasterSize property must be consistent with size(Z) and its RasterInterpretation must be 'cells'.

If R is a referencing vector, it must be a 1-by-3 with elements:

[cells/degree northern_latitude_limit western_longitude_limit]

If R is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to/from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel.

grid2image(Z,R,'PropertyName',PropertyValue,...) uses the specified image properties to display the map. See the image function reference page for a list of properties that can be changed.

h = grid2image(...) returns the handle of the image object displayed.


Display a regular data grid as an image.

load topo
R = georasterref('RasterSize', size(topo), ...
   'Latlim', [-90 90], 'Lonlim', [0 360]);
figure; grid2image(topo, R)

Introduced before R2006a

Was this topic helpful?