Le vendredi 11 septembre 2015 à 16:03 -0700, [email protected] a écrit : > Is there a Julia function/method to find the location(s) of a > sequence of elements in a 1-D array? > > With strings, you can do: > > search("longstring", "str") > > 5:7 > > so with arrays it would hopefully be something like: > > searcharray( [1, 3, 5, 7, 9, 11, 13], [5, 7, 9]) > > 3:5 It doesn't exist at the moment, though an implementation would certainly be accepted. It could be a method for search(), or a new function called findseq(): https://github.com/JuliaLang/julia/issues/10593#issuecomment-90249829
If you want to give it a try, you could generalize a bit the existing method for search() which only works on UInt8 arrays: julia> search(UInt8[1, 3, 5, 7, 9, 11, 13], UInt8[5, 7, 9], 1) 3:5 Regards
