Finding Patterns in Array
조회 수: 31 (최근 30일)
이전 댓글 표시
Hi guys, how do I find in my specific binary pattern in another array that has binary values? I mean lets assume I have
a=[1 0 1] (binary values)
the other array b=[1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1] (binary values)
So Im searching inside b about a which I want to return the started index of my pattern in other other array, any help how could I implement that?
댓글 수: 0
답변 (1개)
Voss
2020년 6월 29일
Look into strfind.
idx = strfind(b,a); % strfind implicitly converts a and b to char arrays
댓글 수: 3
Turlough Hughes
2020년 7월 9일
Your vectors a, and b remain unchanged. The output of strfind is a start index for each occurence of a in b as you requested.
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!