vlookup fuction for matlab

5 visualizaciones (últimos 30 días)
Anfal Abdulrahman
Anfal Abdulrahman el 9 de Abr. de 2017
Comentada: Andres Bergsneider el 29 de Mayo de 2020
Greetings all,
I have table with a size 54 by 4 I need to use something equivalent to the vlookup(lookup val, table, column index) (i.e. vlookup(3.4,tableA,3) in matlab. would appreciate your help here :)
Thank you

Respuesta aceptada

the cyclist
the cyclist el 9 de Abr. de 2017
Here is one way:
% The input matrix
M = magic(5);
% Input for element to find
elementToFind = 23;
colToReturn = 4;
% The algorithm
[tf,rowWithElement] = ismember(elementToFind,M(:,1));
output = M(rowWithElement,colToReturn);
  2 comentarios
Anfal Abdulrahman
Anfal Abdulrahman el 10 de Abr. de 2017
Thank you very much worked perfectly :)
Andres Bergsneider
Andres Bergsneider el 29 de Mayo de 2020
Woaa, thank you!

Iniciar sesión para comentar.

Más respuestas (1)

the cyclist
the cyclist el 9 de Abr. de 2017
Someone has contributed this vlookup function to the File Exchange. I haven't used it myself, so I can't comment on how well it works.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by