|
From: Travis O. <oli...@ee...> - 2006-01-25 19:40:30
|
Dani Marti wrote: >Hi all, > >I have a long 1D boolean array. I'd like to know where a certain >'sub'array (like, e.g., ([1,1,1,1,1,1])) occurs in the array. That is, I >want the index of the first occurrence of a subarray in an array, >avoiding the use of explicit loop structures to carry out the search. > > Actually, I don't think that's a trivial question. You could look at the data as a string and use the find method of the string. Or you could use (int8) correlation. The largest value of the correlation should be the index where it matches. -Travis |