File Exchange

image thumbnail

gc2dec

Function to convert a gray coded sequence to a decimal sequence.

3 Downloads

Updated

No License

This function converts a gray coded string to its equivalent decimal representation. It accepts rows of gray coded string and returns the equivalent decimal sequence as a column vector.

Example:

>>g = [1 0 0 1 1;0 0 0 1 1; 0 1 1 0 1];
>>gc2dec(g)

ans =

    29
     2
     9

Comments and Ratings (2)

Jim

Jim (view profile)

Here's a gray to standard translation using builtins, no explicit looping:

d=bin2dec(int2str(mod(cumsum(dec2bin(g)=='1'),2)));

Cathy Williams

neat work!

MATLAB Release
MATLAB 6.5.1 (R13SP1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video