Can I use unary coding to convert a vector of decimals into a binary matrix?
11 views (last 30 days)
Show older comments
I am trying to convert a decimal vector into a matrix of binary numbers using unary coding. For example:
1 -> 1 0 0 0
2 -> 0 1 0 0
3 -> 0 0 1 0
4 -> 0 0 0 1
I'd like to do this using vector arithmetic, not looping over all of the rows.
1 Comment
Walter Roberson
on 18 Mar 2013
There are multiple competing stands for unary coding. Which one are you following? How are you representing 0? How are you representing negative numbers? Do you need to represent fractions?
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!