arraypat

This function searches for a pattern in an array

Vous suivez désormais cette soumission

This function searches for an n-dimentional pattern in a k-dimentional array.
Its output is the linear indices of the beginnings of matches. Matches can overlap.
There are 2 debug blocks: the first is for generation of a random array & pattern, and the second is for output check using subscripts and ranges.
I tested the function on random 0-9-dimentional arrays and patterns, and on arrays which were repmats of patterns (to compare performance when there are a lot of matches with performance when there aren't).
  • Note that NaN's are not equal to each other, and will not match.
Much thanks goes to whoever wrote ind2sub, as I took some ideas from it for the n-dimentional loop.

Citation pour cette source

Anan Yablonko (2026). arraypat (https://fr.mathworks.com/matlabcentral/fileexchange/110855-arraypat), MATLAB Central File Exchange. Extrait(e) le .

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.1

Fixed an obvious bug

1.0.0