- strfind
- ismember
- contains
Is there a dsearchn equivalent for strings?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have two cell arrays, one is the array I want to find indices of multiple strings. Say q = { 'A', 'B' } and p = { 'H', 'F', ..., 'Z' }. Is there a function that finds the strings and returns their indices like ans = [ 12, 3 ] ? Or the only way is to use a for loop and find(strcmp(...)) which doesn't seem very efficient?
댓글 수: 0
채택된 답변
Cris LaPierre
2020년 8월 27일
I think you would have to do it one value at a time.
find(contains(p,q(1)))
There are several functions you could use
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!