Remove duplicate on rows
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm working with nominative patent data from french applicants. So my file contains the name of the patent applicants. Each row is a patent, and each contains the name of one of the patent applicants. But there are duplicate. I would like to clean each row of the duplicate names (since each row is a patent and the names are in column). ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1118890/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1118890/image.png)
Does anybody have an idea ?
댓글 수: 0
답변 (1개)
Ergin Sezgin
2022년 9월 7일
Hello Heman,
Try using unique function which returns only the unique elements in the array.
newData = unique(yourData);
If you want the process to be non-case sensitive, for example if there are two elements 'Adam Smith' and 'adam smith', you can use lower function, and then unique function.
[~, idx] = (unique(lower(yourData)));
newData = yourData(idx)
I hope it helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Building and Simulating Electronic, Mechatronic, and Electrical Power System Networks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!