Sorting and averaging Data
조회 수: 2 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!