Node degree from lat/lon

14 ビュー (過去 30 日間)
Erick Koenig
Erick Koenig 2020 年 9 月 28 日
コメント済み: Walter Roberson 2020 年 9 月 29 日
Hello, I'm trying to find the most popular locations from a list of 36000 lat/lon coordinates. I was hoping to use the indegree function and pull the top 10 results, but it doesnt seem to like to work with non-whole numbers such as lat/lon pairs. Is there a way of finding the most commonly occuring pairs from an array? It is currently set up as an x and y coordinate so would sort arrange them by x OR y, but not as a pair.
Thank you for your help.
Erick
  2 件のコメント
Steven Lord
Steven Lord 2020 年 9 月 28 日
Do you have a digraph connecting the various locations specified by longitude and latitude values? Or do you just have a list of coordinates like:
rng default
xy = randi([1 10], 30, 2);
Erick Koenig
Erick Koenig 2020 年 9 月 28 日
At the moment, it's a list of coordinates like [-74.1624 40.91464 ] in a 36000 X 2 array.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 9 月 28 日
編集済み: Walter Roberson 2020 年 9 月 29 日
Is there a way of finding the most commonly occuring pairs from an array?
You do not have a graph, so you cannot use graph() object techniques.
One approach:
[count, ids] = groupcounts(YourMatrix);
NewMatrix = [ids{1}, ids{2}, count];
but... you should probably be using inexact comparisons, which groupcounts and findgroups will not do by default:
[groups, ~, groupnum] = uniquetol(YourMatrix, 'byrows', true);
count = histcounts(groupnum, 1:max(groupnum));
NewMatrix = [groups, count];
  3 件のコメント
Erick Koenig
Erick Koenig 2020 年 9 月 28 日
I'm getting..
Error using ismembertol
Too many input arguements
Walter Roberson
Walter Roberson 2020 年 9 月 29 日
Sorry, I corrected the code.

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

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by