Sorting and averaging Data

2 ビュー (過去 30 日間)
Felix
Felix 2018 年 7 月 31 日
回答済み: dpb 2018 年 7 月 31 日
Hey everyone,
I have a the following Problem: I have a table with the structure of the form
GPS_LONG|GPS_LAT|A|B
with lots of data points. What I want to to is to identify the 2D-Data points (GPS_LONG,GPS_LAT) which are equal. If there exists such points, I want to build the mean value over A and B and, so that I only have one unique data point (GPS_LONG,GPS_LAT) left. I know that this could basically done with two loops over the array, comparing each point with all other ones. Since I only have limited computing power and lots of data, I need a smart and efficient way to do it!
Thanks in advance!

採用された回答

dpb
dpb 2018 年 7 月 31 日
Are the position data points exact duplicates? If so,
[g,tGPS]=findgroups(t.GPS_LONG,t.GPS_LAT); % groups table
tGPS.A=splitapply(@mean,A,g); % add means to the
tGPSB.=splitapply(@mean,B,g); % groups table
If you have positions that are close but not identical that want to consider as equals, build the indication vector of which with ismembertol as a new grouping variable.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by