Main Content

grid2world

Convert grid indices to world coordinates

Since R2019b

Description

example

xy = grid2world(map,ij) converts a [row col] array of grid indices, ij, to an array of world coordinates, xy.

Examples

collapse all

Create an empty occupancy map with a width and height of 10 meters.

map = occupancyMap(10,10);

Get world coordinates from grid indices.

[i,j] = meshgrid(1:5);
xyWorld = grid2world(map,[i(:) j(:)]);

Input Arguments

collapse all

Map representation, specified as a occupancyMap, mapLayer, multiLayerMap, or signedDistanceMap object.

Grid positions, specified as an n-by-2 matrix of [i j] pairs in [rows cols] format, where n is the number of grid positions. The grid cell locations are counted from the top left corner of the grid.

Data Types: double

Output Arguments

collapse all

World coordinates, returned as an n-by-2 matrix of [x y] pairs, where n is the number of world coordinates.

Data Types: double

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b

expand all