How to arrange grid data?

1 回表示 (過去 30 日間)
Sunil Oulkar
Sunil Oulkar 2016 年 2 月 17 日
コメント済み: Sunil Oulkar 2016 年 2 月 18 日
Hello guys... i have a grid data ,for eg given below, here 1st row is longitude, 1st column is latitude and their corresponding data
21 22 23 24 25
65 1 5 7 8 9
66 3 8 4 9 1
67 5 8 9 1 3
68 5 6 9 2 3
69 4 1 5 3 2
here i want rearrange the data. i want to make only three column 1st column should be latitude, 2nd column should be longitude and 3rd column should contain their corresponding data
  1 件のコメント
Stephen23
Stephen23 2016 年 2 月 17 日
How is your "grid data" stored? Is it in a file, or a MATLAB variable, or are you going to enter it manually?

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

採用された回答

Stephen23
Stephen23 2016 年 2 月 17 日
>> X = [NaN 21 22 23 24 25
65 1 5 7 8 9
66 3 8 4 9 1
67 5 8 9 1 3
68 5 6 9 2 3
69 4 1 5 3 2];
>> [Lat,Lon] = ndgrid(X(2:end,1),X(1,2:end));
>> dat = X(2:end,2:end);
>> out = [Lat(:),Lon(:),dat(:)]
out =
65 21 1
66 21 3
67 21 5
68 21 5
69 21 4
65 22 5
66 22 8
67 22 8
68 22 6
... more here
67 25 3
68 25 3
69 25 2
  1 件のコメント
Sunil Oulkar
Sunil Oulkar 2016 年 2 月 18 日
Thank you...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by