comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Efficient pattern-matching in a large array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Efficient pattern-matching in a large array [message #77059] Tue, 02 August 2011 11:29
John Correira is currently offline  John Correira
Messages: 25
Registered: August 2011
Junior Member
On 08/02/2011 02:05 PM, Chris O'Dell wrote:
> I have a byte array of tens of millions values (read from a binary
> file). I want to find an 8-byte pattern where ever it occurs. Similar
> to where, but 8 values at a time instead of one. The problem is
> finding a way to do this that is as fast as possible. The pattern is:
> [234, 203, 138, 216, 21, 52, 117, 39].
>
> Right now, I have this in a big loop and it takes a while. We tried
> "match2" but it ran out of memory.
>
> Thanks,
> Chris
>

Would the following do the trick?


index = where( array eq 234B $
AND shift(array,-1) eq 203B $
AND shift(array,-2) eq 138B $
AND shift(array,-3) eq 216B $
etc etc


Regards,

John
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Eclipse plugin - reading and writing to IDL variables
Next Topic: Re: IDL Windows Question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:37:57 PDT 2025

Total time taken to generate the page: 0.00565 seconds