Convert binary integers to quaternary integers
Show older comments
Is it possible to convert binary integers generated using a randi() to quaternary integers (0-3) by taking two bits from the source and combining them?
Accepted Answer
More Answers (1)
Walter Roberson
on 17 May 2012
0 votes
Yes. B1*2 + B2
2 Comments
M
on 17 May 2012
Walter Roberson
on 17 May 2012
If you need to, put the 4 possible results into a vector, and index the vector at B1*2 + B2 + 1
Categories
Find more on Graph and Network Algorithms 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!