k-Wave Toolbox |

# grid2cart

Return the Cartesian coordinates of the non-zero points of a binary grid

## Syntax

    [cart_data, order_index] = grid2cart(kgrid, grid_data)

## Description

`grid2cart` returns the set of Cartesian coordinates corresponding to the non-zero elements in the binary matrix `grid_data`, in the coordinate framework defined in `kgrid`.

## Inputs

`kgrid` | k-Wave grid structure returned by `makeGrid`
`grid_data` | binary grid with the same dimensions as the k-space input grid `kgrid`

## Outputs

`cart_data` | 1 x N, 2 x N, or 3 x N (for 1, 2, and 3 dimensions) array of Cartesian sensor points
`order_index` | the order that the Cartesian points appear in `grid_data` according to MATLAB's standard column-wise linear matrix index ordering

## See Also

`cart2grid`, `interpCartData`, `makeGrid`

© 2009, 2010 Bradley Treeby and Ben Cox.