| Contents | Index |
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.
This block accepts a scalar, column vector, or full matrix input signal. It can accept multichannel inputs and allows for input and output data types of double, single, int32, int16, int8, uint32, uint16, and uint8. The input signal must be a non-negative value. The block truncates non-integer input signals as integer values.
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 parameter appears only when you set Mapping mode to User Defined.

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |