How to replace/remove duplicate columns datas in a .dat file?

Hello all,
I have a question about how to replace/remove duplicate columns datas in .dat file?
There is a duplicate data of .dat file:
A B C D
0.3 0.8 2.1 6.7
0.3 0.8 2.2 6.6
0.3 0.8 2.5 6.4
0.3 0.6 2.7 6.2
0.3 0.6 2.8 6.0
0.3 0.6 3.0 5.9
...
...
How should I do if the expected output should simply be:
A = 0.3; B = 0.8:
C D
2.1 6.7
2.2 6.6
2.5 6.4
...
...
---------------------
A = 0.3; B = 0.6:
C D
2.7 6.2
2.8 6.0
3.0 5.9
...
...
I tried to use unique to solve, but it deleted my entire row. And what kinds function should I use for edit .dat files? fopen?fscanf?fwrite?
Thanks for all the patience and helps :)
Best regards.

Answers (1)

findgroups() to find the A, B combinations.
Possibly use splitapply() to process the groups.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Release

R2016a

Asked:

on 11 Apr 2022

Answered:

on 11 Apr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!