Convert integer values using lookup table


B = intlut(A, LUT)


B = intlut(A, LUT) converts values in array A based on lookup table LUT and returns these new values in array B. For example, if A is a vector whose kth element is equal to alpha, then B(k) is equal to the LUT value corresponding to alpha, i.e., LUT(alpha+1).

This function supports code generation (see Tips).

Class Support

A can be uint8, uint16, or int16. If A is uint8, LUT must be a uint8 vector with 256 elements. If A is uint16 or int16, LUT must be a vector with 65536 elements that has the same class as A. B has the same size and class as A.


A = uint8([1 2 3 4; 5 6 7 8; 9 10 11 12])
LUT = repmat(uint8([0 150 200 255]),1,64);
B = intlut(A, LUT)

More About

expand all


  • This function supports the generation of C code using MATLAB® Coder™. The code generated for this function uses a precompiled, platform-specific shared library. Use of a shared library preserves performance optimizations but limits the target platforms for which code can be generated. For more information, see Code Generation Using a Shared Library.

See Also


Was this topic helpful?