This is matrix version of VLOOKUP similar to MS Excel function.
Return matrix b which has equal size as m and the values are taken from
from the n column of lookup table lut. It will replace all NaN with zero.
example how to use:
Type this 2 matrix data
> m = [ 1 2 0; 3 4 1]
> lut = [0 0.5 12; 1 0.8 25; 2 0.4 32; 3 0.7 41]
produces
m = [ 1 2 0;
3 4 1]
lut = [0 0.5 12;
1 0.8 25;
2 0.4 32;
3 0.7 41]
> b=vlookup(m,lut,3)
=> [25 32 12;
41 0 25]
> b=vlookup(m,lut,2)
=> [0.8 0.4 0.5;
0.7 0 0.8]
Written by Kardi Teknomo http://people.revoledu.com/kardi/
Note: the code consist of three different versions of vlookup, the fastest is only consist of two lines code uncommented.
Citar como
Kardi Teknomo (2025). VLOOKUP (https://la.mathworks.com/matlabcentral/fileexchange/12453-vlookup), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
- MATLAB > Language Fundamentals > Matrices and Arrays >
- MATLAB > Language Fundamentals > Data Types > Numeric Types >
- MATLAB > Language Fundamentals > Data Types > Tables >
Etiquetas
Agradecimientos
Inspirado por: vlookup - similar to MS Excel function
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
| Versión | Publicado | Notas de la versión | |
|---|---|---|---|
| 1.0.0.0 | update the license |
