Delete the duplicate rows
이전 댓글 표시
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
답변 (2개)
Ameer Hamza
2020년 11월 13일
편집: Ameer Hamza
2020년 11월 13일
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,:)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!