how to implement lookup table in matlab code

how to implement lookup table in matlab code

댓글 수: 3

Cedric
Cedric 2017년 10월 26일
What type of "key" do you need?
Stephen23
Stephen23 2017년 11월 4일
Mustafa Sabah's "Answer" moved here:
Any type ,please
Cedric
Cedric 2017년 11월 4일
편집: Cedric 2017년 11월 4일
But you does "any" mean? Will you have numeric keys only, strings/char keys only, arrays of numbers, various objects, or a mix of any of these types/classes as keys?

댓글을 달려면 로그인하십시오.

답변 (1개)

Guillaume
Guillaume 2017년 11월 4일

1 개 추천

It's puzzling that you're even asking the question. Maybe you have a strange definition of a look-up-table. In any language, a look-up-table is just an array of whatever things you want to look up. Therefore, in matlab, a lut is simply your standard array if whatever it is to store in your table is homogeneous and scalar, and a cell array otherwise.
%lut of 60 numbers
lut = randi(100, 1, 60);
value = lut(10); %get lut value corresponding to index 10
%lut of char arrays:
lut = {'the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'}
value = lut(7); %get lut value corresponding to index 7

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

질문:

2017년 10월 26일

답변:

2017년 11월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by