Learn R Programming

adana (version 1.1.0)

bin2gray: Convert from binary to gray code integer

Description

The function bin2gray converts a binary coded number to gray coded integer.

Usage

bin2gray(bin)

Arguments

bin

A binary coded number.

Value

Returns the gray coded integer equivalent of the input number.

Details

The bin2gray function works as a compliment of the gray2bin function.

See Also

gray2bin

Examples

Run this code
# NOT RUN {
  bin = c(1,0,1,1)
  bin2gray(bin)     # returns 1110
  
  bin = c(1,0,1,0)
  bin2gray(bin)     # returns 1111
# }

Run the code above in your browser using DataLab