Delete the duplicate rows
Mostrar comentarios más antiguos
Hi,
trying in matlab
Simple the had the data repeating it for 32sec.
I need to to write into other file by taking only one sample.
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.007500 34.220001 1995.584000
0.085000 111.720001 75.584000
0.085000 111.720001 75.584000
0.085000 111.720001 75.584000
Tried this code
clc;
clear all;
close all;
fp10 = fopen('inu03.rdt', 'r');
fpid10 = fopen('inuo3_final.out','w');
i=0;
while ~feof(fp10)
i=i+1;
scan1 = fscanf(fp10,'%f %f %f ',[3,1]);
x2 = scan1(1);
fprintf('%d\n',i);
temp =x2;
c = temp-x2;
if(c>=0.08)
fprintf(fpid10,' %10.6f \n',x2);
end
end
Respuestas (2)
KSSV
el 13 de Nov. de 2020
0 votos
Read about unique.
Ameer Hamza
el 13 de Nov. de 2020
Editada: Ameer Hamza
el 13 de Nov. de 2020
You can use unique() function
data = load('data.txt');
data_unique = unique(data, 'rows');
data.txt is attached.
Or if data is repeating after constant interval of 32 the following will be faster
data = load('data.txt');
data_unique = data(1:32:end,:)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!