Compare 2 strings without using ismember or strcmp
이전 댓글 표시
Hi, I've got a code that gives me different outputs and I want to compare the messages inside them and the ones that are not in one string(X) and are in the other(Y) write them into another output. Lets see:
K is the number of messages that has an string.
If K from X is not in Y = L
And I do not want to use ismember or srcmp because the proces would be very long.
I guess I have explained myself.
Thank youuu for the answer!!!
댓글 수: 4
Stephen23
2021년 9월 27일
@vicente Noguer: please give actual examples of X and Y that we can use, and the expected output.
It's not really clear what your variables are or how they are arranged. This is how I read the problem statement:
"[I have] [two?] outputs and I want to compare the messages inside them ... [and I want to extract the ones that are unique to Y]"
Are these actual string arrays, or are they cell arrays of character vectors? Are they something else? Are there actually only two?
What about them would make the built-in tools exceptionally slow?
In some certain restricted cases, there are some faster alternatives to ismember(), but I don't know if any of that even applies, because I don't know what your variables are.
flashpode
2021년 9월 27일
편집: Walter Roberson
2021년 9월 27일
flashpode
2021년 9월 27일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Variables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!