Finding Patterns in Array
28 ビュー (過去 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!