How to return i,j locations for contor location

I use the contour command to return the position (lat and lon) of a specified contour depth i.e. 100m isobath.
[c1,h1] = contour(lon_rho,lat_rho,h,[100 100])
where lon_rho and lat_rho are matrices of lon and lat covering my region of interest and h is the bathymetry. These three matrices are all 542x770.
I can pull the lon and lat for the isobath of interest:
Mylon_100=c1(1,:)
Mylat_100=c1(2,:)
But what I want now it the i and j locations within my original matrices (542x770 grid) for each of the points along my contour line - preferably to a fraction of a grid cell.
i.e. maby a pont on the isobath has lat = 61.9 and lon= 175.3 and falls at grid point i=310.3 and j=645.8
Can anyone think of a smart way to get this information for each point along my isobath?
Thanks!

답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 3월 4일
편집: Youssef Khmou 2013년 3월 4일

0 개 추천

hi ,
you can find the x/y coordinates of specified value in matrix : let s take a simple example:
G=rand(542,770);
G(400,333)=45; % example
[x,y]=find(G==45)
Does this helps a bit ?

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

질문:

2013년 3월 3일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by