mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

analysis/

mg_find_pattern.pro

includes main-level program

Routines

top mg_find_pattern

result = mg_find_pattern(data, pattern)

Finds a 1-dimensional pattern in an array.

Return value

index array or !null if pattern not found

Parameters

data in required type=array

array to search for pattern

pattern in required type=array

pattern to find in the data

Examples

For example, try the main-level program at the end of this file:

IDL> .run mg_find_pattern
It finds a simple pattern in random integers:
IDL> d = long(randomu(0L, 32) * 100L) IDL> print, d 41 9 75 52 93 38 65 6 72 67 38 63 88 51 65 23 26 76 75 90 7 27 89 27 51 35 24 48 84 83 3 99 IDL> print, mg_find_pattern(d, [63, 88, 51]) 11 IDL> print, d[11:13] 63 88 51

Author information

History:

Developed from code posted by JD Smith to the IDL newsgroup 8/16/2011

Other attributes

Requires:

IDL 8.0

File attributes

Modification date: Wed May 14 15:07:14 2014
Lines: 15
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.