Find myltiple numbers in array
multiFind serves a similar purpose as find but when looking for multiple elements in an array of numbers. It returns two arrays of numbers. Each row of the two arrays contains the pair of indexes in which the numbers were found in the two arrays
Input:
array: the array in which you want to find some numbers
nums: the numbers you are looking for inside the array
varargin:
type: type refers to the type of the output. If it gets the value
'index', it returns just the pairs of indexes of the numbers in the
two arrays 'array' and nums respectively. If it gets the value 'bin', it returns
two binary arrays, with 1's where the elements were found in the two arrays.
Default value: 'index'
except: if you want to exclude specific numbers from the search, you
use the except options and declare these numbers
Output:
idx: the indexes of the found numbers in the first array
posIdx: the indexes of the numbers in 'nums' of the numbers that were
also found in 'array'
Example:
im1 = randi(1000, 100, 1) ;
im2 = randi(1000, 100, 1) ;
[ix1, ix2] = multiFind(im1, im2) ;
[ix1, ix2] = multiFind(im1, im2, 'type', 'index') ;
[ix1, ix2] = multiFind(im1, im2, 'type', 'bin') ;
[ix1, ix2] = multiFind(im1, im2, 'except', [1, 3]) ;
Author: Efstratios Gavves
email: efstratios.gavves@gmail.com
website: http://staff.science.uva.nl/~gavves/
Cita come
Stratis Gavves (2025). Find myltiple numbers in array (https://it.mathworks.com/matlabcentral/fileexchange/28849-find-myltiple-numbers-in-array), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 |
