Main Content


Convert local coordinates to grid indices


ij = local2grid(map,xy) converts an array of local coordinates, xy, to an array of grid indices, ij in [row col] format.

Input Arguments

collapse all

Map representation, specified as a binaryOccupancyMap object. This object represents the environment of the vehicle.

Local coordinates, specified as an n-by-2 matrix of [x y] pairs, where n is the number of local coordinates.

Data Types: double

Output Arguments

collapse all

Grid positions, returned as an n-by-2 matrix of [i j] pairs in [row col] 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

Extended Capabilities

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

Version History

Introduced in R2019b