Given that you are effectively looking for an exact match to numeric data, then judicious use of image expressions may be the most efficient path to a solution. Roughly following your example, we begin by setting up source data and target pattern:
Image sourceData := RealImage("Source data", 4, 4096);
sourceData = Random();
Image targetPattern := RealImage("Target pattern", 4, 15);
targetPattern = sourceData.Index(icol + 1733, 0);
Then we prepare a carefully arranged search buffer with a single image expression:
Number targetSize = targetPattern.ImageGetDimensionSize(0);
Number searchBufferW = sourceData.ImageGetDimensionSize(0) - targetSize;
Image searchBuffer := RealImage("Search buffer", 4, searchBufferW, targetSize);
searchBuffer = sourceData.Index(icol + irow, 0);
This arranges all potential matching subsets of the source data in vertical columns of a 2D image. Finally we do a little image math to locate the match to the target pattern, if one exists:
searchBuffer = Abs(searchBuffer - targetPattern.Index(irow, 0));
Image projectionVector := targetPattern.ImageClone();
projectionVector = 1.0;
Image searchResult := projectionVector.MatrixMultiply(searchBuffer);
Number posX, posY;
Number wasFound = (searchResult.Min(posX, posY) == 0);
String resultMsg = (wasFound) ? "Pattern found at " + posX : "Pattern not found";
OKDialog(resultMsg);
The first line will yield an exact zero in every pixel of the search buffer column that matches the target pattern. Vertically summing the search buffer and using the Min() function to find a zero speeds up the search for a match.
Note the use of MatrixMultiply() to do a rapid vertical sum projection. This will only work for type Real (4-byte floating point) source data. There are, however, slightly more complex approaches to rapid data projection that will also give a fairly quick result for any numeric data type.
Although illustrated for a 1D pattern in a 1D data set, this approach can probably be extended to 1D and 2D patterns in 2D and 3D data sets by using a multi-dimensioned search buffer and more advanced indexing using ImageDataSlice objects, but that would be a subject for another question.