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 件)
KSSV
2020 年 11 月 13 日
0 投票
Read about unique.
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!