Removal of duplicate data
조회 수: 25 (최근 30일)
이전 댓글 표시
Hello everyone!
I'm working on a project where the goal is to recieve data from a flying object. The data is recieved from different stations along the flight path. The data need to be plotted in MatLab and displayed graphically. The data is stored in a .txt-file, and I have managed to import this data to MatLab. The recieved data contains information like the voltage, RSSI and times between each packet++.
The problem with multiple stations, is that the same data sent by the flying object will be collected at multiple stations. The issue i have is to remove this duplicate data, so that it is not plotted twice.
I have attached a picture from the .txt-file. Column 2 are the station numbers and column 3 are the package numbers. Red line to show separation between stations and duplicate data between the blue lines.
As I'm not very skilled in MatLab, could someone point me in the right direction on what i can do to remove this data?
Also, would it be possible to make a plot so that the graph starts with the first station, continues with the next, and so on.. ?
Sincerly Jørgen
(English is not my first language, so please excuse me)
-댓글 수: 2
Walter Roberson
2021년 3월 24일
I see you have packet number 54 detected by station 170 and station 187. How do you decide which of the two to keep? For example do you want to keep the one with highest RSSI? Is there a time stamp and you want to keep the one with the earliest time stamp?
채택된 답변
William Rose
2021년 3월 24일
I assume your data is in an array called data() with 9 columns and many rows, and column 2 is the station number.
Sort data by the columns with priority 1,3,4,5,6,7,8,9,2. By using column 2 as the last for sorting, rows that only differ in column 2 will be adjacent after the sort. Then you compare each row to the next row. If they are identical except for column 2, delete the next row. Rpeat until the next row does not match, then proceed to the next row, etc.
댓글 수: 4
Walter Roberson
2021년 3월 25일
Subset = Raw(b, 2)n
[~, IA] = unique(Subset, 'rows', 'stable');
selected_entries = Raw(IA,:);
This assumes that column 2 by itself is enough to determine uniqueness.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!