Two matrices (n x 1) & (m x 1) : How to get an output matrix of size (n x m) containing pairs

1 回表示 (過去 30 日間)
Nayef Zrigat
Nayef Zrigat 2021 年 11 月 10 日
回答済み: Fangjun Jiang 2021 年 11 月 10 日
Hi All,
I have two matrices for latitude and longitude with the following size: Latitude (41x 1) and Longitude(81 x 1)
I need to get an output matrix of the size ((41 * 81) x 1) or ((41*81) x 2) - size is containing pairs of coordinates, so basiically first row of Latitude paired with all longitudes (one at a time), then take second row of Latitude and apply the same. (How I imagine it is done)
I would appreciate any guidance on how to perform this task.
Cheers,
NZ

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2021 年 11 月 10 日
I would not think you need to create such a matrix. That matrix simply duplicates lots of data. The truly useful and unique data are still your original data, the 41 Latitude and 81 Longitude data.
What you need is the index of your location, then you can find out the position of your location. For example
x=4;
y=5;
YourLocation=[Latitude(4), Longitude(5)]

カテゴリ

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