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)

 채택된 답변

Voss
Voss 2023년 8월 17일
편집: Voss 2023년 8월 17일
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"

댓글 수: 2

thank you for the fast answer
Voss
Voss 2023년 8월 18일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

제품

질문:

2023년 8월 17일

댓글:

2023년 8월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by