Removing Partially Identical Rows from Array sets

Hi,
after converting this file into an array of HEX numbers, I would like to supress the line where some values are the same as another line:
for exemple, i want to remove a line if all the numbers execpt for the 3rd and 5th one are identical to the numbers in another line (i want to remove the 3rd and 5th number from the comparaison process but i don't want to remove them from the array)

 Accepted Answer

Using Walter's code from his answer to your other question to read and interpret the file:
S = readlines('test.txt');
S(strlength(S) == 0) = []; %end of file usually comes through as empty line
SS = regexp(S, '\s+', 'split');
wanted = vertcat(SS{:})
wanted = 12×24 string array
"12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "00" "02" "23" "40" "65" "84" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "FF" "FF" "FF" "FF" "FF" "51" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF"
Now get the set of unique rows, ignoring the specified columns:
cols = [3 5];
temp = wanted;
temp(:,cols) = [];
[~,ii] = unique(temp,'rows','stable');
result = wanted(ii,:)
result = 3×24 string array
"12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "68" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "00" "02" "23" "40" "65" "84" "94" "12" "63" "67" "05" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF" "12" "AB" "5A" "00" "00" "02" "23" "40" "65" "84" "FF" "FF" "FF" "FF" "FF" "51" "49" "99" "AA" "FF" "FF" "FF" "FF" "FF"

More Answers (0)

Categories

Products

Asked:

on 17 Aug 2023

Commented:

on 18 Aug 2023

Community Treasure Hunt

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

Start Hunting!