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!