MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Pooja
on 15 Feb 2013

Please help me to write matlab code for decimal to both binary and unary.I need to make decimal to binary and unary which is used in rice codes.

*No products are associated with this question.*

## 3 Comments

## Walter Roberson

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/63606#comment_129834

Whichunary coding? http://en.wikipedia.org/wiki/Unary_codingAnd do you need to include negative values? How about fractional values?

## Pooja

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/63606#comment_130009

Yes this unary coding.Actually the concept is over there in http://en.wikipedia.org/wiki/Golomb_coding. Shouldnt need fractional and negative values.

## Walter Roberson

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/63606#comment_130025

Do you want the end-of-string marker to be 0's or 1's?