searchsorted

Version 1.0.0 (2,01 ko) par Luke Jenkins
Binary search in the style of numpy's searchsorted
30 téléchargements
Mise à jour 15 avr. 2024

Afficher la licence

Finds indices in sorted vector x where values would be inserted to maintain sorted order: in style of numpy searchsorted.
indices = searchsorted(x, values)
name value arguments (nv):
'side' (default: 'left')
e.g., side='left': x = [1, 3, 5, 5, 7], values = [2, 5, 7] -> indices = [2, 3, 5]
side='right': x = [1, 3, 5, 5, 7], values = [2, 5, 7] -> indices = [2, 4, 5]
'sortfirst' (default: false)
if true, x will be sorted prior to the search.
Credit: DrGar
(https://stackoverflow.com/questions/20166847/faster-version-of-find-for-sorted-vectors-matlab)
Amended by Luke Jenkins, Apr 2024

Citation pour cette source

Luke Jenkins (2026). searchsorted (https://fr.mathworks.com/matlabcentral/fileexchange/163511-searchsorted), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2024a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Version Publié le Notes de version
1.0.0