vlookup fuction for matlab
조회 수: 5 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
the cyclist
2017년 4월 9일
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
추가 답변 (1개)
the cyclist
2017년 4월 9일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!