Vectorized FIND
by Steven Lord
08 Mar 2002
(Updated 12 Mar 2002)
This function returns the locations of the elements of a vector in a matrix.
|
Watch this File
|
| File Information |
| Description |
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. |
| MATLAB release |
MATLAB 6.0 (R12)
|
| Other requirements |
This function has been tested in MATLAB 5.3 (R11) and MATLAB 6.0 (R12). |
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (2) |
| 12 Mar 2002 |
u s
|
|
|
| 04 Jul 2006 |
Ofek Shilon
|
|
|
|
Contact us at files@mathworks.com