Removing duplicate coordinates in a GPS measurement logfile
1 view (last 30 days)
Show older comments
Hi there,
I have a problem. I have these raw data GPS measurements. Sometimes I find that the measurement will show errors that are related to going back to a certain intial position. This creates hand fan like plots when I plot the measurement. Cleaning up this log files could start by stating that no duplicates of a specific coordinate can occur.
Now I'm faced with finding those duplicates and removing them. I have found the Unique function, but I can't seem to work out how to remove all the double or multiple entries. There are multiple files that contain thousands of coordinates per file. Being able to clean that up a bit would be very helpfull for the computation time. Can somebody help me out here?
I am looking for the following functionality
- Loading a file,
- loading the appropiate columsn (X,Y, Z),
- storing that in either a variable or seperate file,
- clearing memory of files data that is obsolete.
- repeat for new file
The data in the files looks a bit like the following example
Raw Variable Data
0 9 0
5 5 0
1 8 0
5 5 0
2 7 0
5 5 0
3 6 0
4 5 0
5 4 0
6 3 0
7 2 0
3 1 0
3 1 0
8 1 0
3 1 0
3 1 0
9 0 0
This is what I would like it to look like after clean up. (removing the coordinates 5 5 0 and 3 1 0
Clean Variable data
0 9 0
1 8 0
2 7 0
3 6 0
4 5 0
5 4 0
6 3 0
7 2 0
8 1 0
9 0 0
Up to now, I have the following code for working through the files.
clc
clear all
clear mex
clc
files = dir('*.txt')
for i=1:9%length(files);
eval(['load ' files(i).name ' -ascii'])
variableName = whos;
str=[variableName(i).name]
disp(str)
length=[variableName(i).size(1)];
variable=eval(str);
X=[variable(:,8)];
Y=[variable(:,10)];
A(:,1)=X;
A(:,2)=Y;
% [UniXY,Index]=unique(A,'rows');
% DupIndex=setdiff(1:size(A,1),Index);
% A(DupIndex,:)=[];
% X=A(:,1)';
% Y=A(:,2)';
% clear variable
end
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!