| Communications Blockset™ | ![]() |
Utility Blocks
The Data Mapper block accepts integer inputs and produces integer outputs. You can select one of four mapping modes: Binary to Gray, Gray to Binary, User Defined, or Straight Through.
The input can be either a scalar, a sample-based vector, or a frame-based column vector. The block can accept multichannel inputs and allows for input and output data types of double, single, int32, int16, int8, uint32, uint16, and uint8. If the input is double or single, then it must be non-negative in value. Note that although the block will provide outputs for non-integer valued inputs, the results will likely be meaningless.
Gray coding is an ordering of binary numbers such that all adjacent numbers differ by only one bit. However, the inputs and outputs of this block are integers, not binary vectors. As a result, the first two mapping modes perform code conversions as follows:
In the Binary to Gray mode, the output from this block is the integer equivalent of the Gray code bit representation for the input integer.
In the Gray to Binary mode, the output from this block is the integer position of the binary equivalent of the input integer in a Gray code ordering.
As an example, the table below shows both the Binary to Gray and Gray to Binary mappings for integers in the range 0 to 7. In the Binary to Gray Mode Output column, notice that binary representations in successive rows differ by exactly one bit. In the Gray to Binary Mode columns, notice that sorting the rows by Output value creates a Gray code ordering of Input binary representations.
| Binary to Gray Mode | Gray to Binary Mode | ||
|---|---|---|---|
| Input | Output | Input | Output |
| 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. For example, the vector [1,5,0,4,2,3] defines the following mapping:
![]()
When you select the Straight Through mode, the output equals the input.

The type of data mapping that the block performs.
Symbol set size of M restricts this block's inputs and outputs to integers in the range 0 to M-1.
A vector of length M that contains the integers from 0 to M-1. The order of the elements of this vector specifies the mapping of inputs to outputs. This field is active only when Mapping mode is set to User Defined.
![]() | CRC-N Syndrome Detector | DBPSK Demodulator Baseband | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |