How to identify partial string duplicates in a table
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I have a table of strings - see attached, and I want to be able to programatically identify and extract the identical part of the strings within that table.
For example, in the attached mat. the strings are:
'*EndoPart*' and '*EndoCort*'
Is there a way to identify the identical portion of the string ('Endo') in the entire column and extract it?
Thank you!
댓글 수: 0
답변 (1개)
Stephen23
2020년 11월 28일
Actually the identical part at the start of the string is '*Endo', and this is easy to find:
>> X = logical(cumprod(all(diff(TableExample.group,1,1)==0,1)));
>> TableExample.group(1,X)
ans =
*Endo
There is also an identical part at the end of the string 'rt*', but I assume that you only want the identical part at the start.
댓글 수: 2
Stephen23
2020년 11월 28일
@David Mabwa : I don't think I can open that table with the MATLAB versions I have available to me.
Perhaps someone else might be so kind as to investigate this further.
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!