# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# intlut

Convert integer values using lookup table

## Syntax

```B = intlut(A, LUT) ```

## Description

`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)`.

## 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`.

## Examples

collapse all

Create an array of integers.

`A = uint8([1 2 3 4; 5 6 7 8; 9 10 0 1])`
```A = 3x4 uint8 matrix 1 2 3 4 5 6 7 8 9 10 0 1 ```

Create a lookup table. In this example, the lookup table is created by following the vector [2 4 8 16] with repeated copies of the vector [0 150 200 250].

`LUT = [2 4 8 16 repmat(uint8([0 150 200 255]),1,63)];`

Convert the values of A by referring to the lookup table. Note that the first index of the lookup table is 0.

`B = intlut(A, LUT)`
```B = 3x4 uint8 matrix 4 8 16 0 150 200 255 0 150 200 2 4 ```