Converting 2D matrix to vectors

Hello,
I have a matrix of 419x419 data that has NaN's throughout. I have a longitude vector of 419x1 and a latitude vector of 419x1. I would like to convert the data (419x419) into three columns: latitude, longitude, and correlated data. Is there a way to do this?
Thanks,
Melissa

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 5 月 13 日

1 投票

[tLat, tLong] = ndgrid(Latvec, Longvec);
LLdata = [tLat(:), tLong(:), dataarray(:)];
Note: you did not specify whether the 419 x 419 has latitude running down the columns or across the rows. You will want to test the above with a subset of your data before you generate the whole thing.

カテゴリ

ヘルプ センター および File ExchangeGeodesy and Mapping についてさらに検索

質問済み:

2015 年 5 月 13 日

回答済み:

2015 年 5 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by