Main Content

Data Mapper

Map integer symbols from one coding scheme to another

  • Library:
  • Communications Toolbox / Utility Blocks

  • Data Mapper block


The Data Mapper block accepts integer inputs and maps them to integer outputs. The mapping types include: binary to Gray coded, Gray coded to binary, and user defined. Additionally, a pass through option is available.

Gray coding is an ordering of binary numbers such that all adjacent numbers differ by only one bit.



expand all

Input signal, specified as a scalar, vector, or matrix of integers. Elements of the input signal must be nonnegative values. The block truncates noninteger values to integer values. When the input is a matrix, the columns are treated as independent channels.

Data Types: double | single | int8 | int16 | int32 | uint8 | uint16 | uint32


expand all

Output signal, returned as a scalar, column vector, or matrix. The dimensions of the output signal match those of the input signal.

Data Types: double | single | int8 | int16 | int32 | uint8 | uint16 | uint32


expand all

Mapping mode, specified as one of the four options. The mapping for the Binary to Gray and the Gray to Binary modes are shown in the following table when the inputs range from 0 to 7.

Binary to Gray ModeGray to Binary Mode
0 0 (000) 0 (000) 0
1 1 (001) 1 (001) 1
2 3 (011) 2 (010) 3
3 2 (010) 3 (011) 2
4 6 (110) 4 (100) 7
5 7 (111) 5 (101) 6
6 5 (101) 6 (110) 4
7 4 (100) 7 (111) 5

When you select the User Defined mode, you can use any arbitrary mapping by providing a vector to specify the output ordering. When you select the Straight Through mode, the output equals the input.

Symbol set size, specified as a positive integer. This parameter restricts the inputs and outputs to integers in the range of 0 to M-1.

Mapping vector, specified as vector of nonnegative integers whose length equals . This parameter defines the relationship between the input and output integers. For example, the vector [1 5 0 4 2 3] defines the following mapping:


Block Characteristics

Data Types

double | fixed point | integer | single

Multidimensional Signals


Variable-Size Signals


Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a