Mapping Toolbox    
yx2rc

Convert x- and y-coordinates to row and column indices

Syntax

Description

[rowgrat,colgrat] = yx2rc(ygrat,xgrat,y1,x1,yperrow,xpercol) computes row and column indices from y- and x-coordinates. ygrat and xgrat are the Cartesian coordinates for a grid with the upper left corner at coordinates x1 and y1. yperrow and xpercol are the y- and x-increment per row and column. The outputs rowgrat and colgrat correspond to matrix locations ygrat and xgrat.

Examples

Remarks

This function is used for one step in the process of extracting projected matrix data from a file. The process generally consists of the following steps: 1) define the map projection as described in the data source documentation, 2) map desired geographic limits into projected coordinates using mfwdtran, 3) use yx2rc to determine associated row and column limits in the stored matrix, 4) extract sub-matrix using readmtx, 5) convert graticule of row and column indices to projected x and y coordinates using rc2yx, 6) convert x and y to geographic graticule using minvtran.

See Also
rc2yx
Row and column indices to x- and y-coordinates
readmtx
Read a matrix stored in a file


  worldmap zdatam