Vectorized FIND

This function returns the locations of the elements of a vector in a matrix.
2,3K download
Aggiornato 12 mar 2002

Visualizza la licenza

If A is a matrix and b is a column vector, this function returns a column vector of indices I such that A(I)==b if the elements of b are in A. If an element of b is not in A, then the corresponding element of I is Inf.

As an example, you can execute the following code:

rand('state',0)
A=floor(20*rand(5))
b=[18;8;9;6]
I=findin(A,b)
A(I(1:3))

The example above uses I(1:3) because I(4) is Inf; the matrix A does not have 6 as an entry.

Cita come

Steven Lord (2024). Vectorized FIND (https://www.mathworks.com/matlabcentral/fileexchange/1472-vectorized-find), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R12
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Operating on Diagonal Matrices in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0