find the corresponding x and y coordinates

2 ビュー (過去 30 日間)
Anitha Limann
Anitha Limann 2022 年 9 月 9 日
コメント済み: Torsten 2022 年 9 月 10 日
Hello,
Can some one help me find the "i" th value inside a [x,y] grid and get the coordinations of that?
Eg:
x are longitudes (columns); from -175:0.02:-179
y are latitudes (rows): from 10:0.02:20
I need to find the latitude and longitude coordinate of 100th grid node.
How can I do that?
Thank you
  3 件のコメント
Anitha Limann
Anitha Limann 2022 年 9 月 10 日
I want to start from -175 and to go -179 (west longitudes)
then -10 to go to -20. (south latitudes)
Attached here is an example grid.
Torsten
Torsten 2022 年 9 月 10 日
Do you want to go
1st grid point: -179 -20
2nd grid point: -179.02 -20
3rd grid point: -179.04 -20
...
or
1st grid point: -179 -20
2nd grid point: -179 -19.98
3rd grid point: -179 -19.96
...
Note that you should always go from low to high in each direction (thus from -179 to -175 and -20 to -10), not vice versa.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2022 年 9 月 9 日
編集済み: Torsten 2022 年 9 月 9 日
i=100;
x=-179:0.02:-175;
y=10:0.02:20;
[j,k]=ind2sub([numel(x),numel(y)], i);
xi=x(j)
xi = -177.0200
yi=y(k)
yi = 10
  1 件のコメント
Anitha Limann
Anitha Limann 2022 年 9 月 10 日
gives me error below
Not enough input arguments.
Error in ind2sub (line 45)
vi = rem(ndx-1, siz(1)) + 1;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMap Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by