Convert binary integers to quaternary integers
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 17 de Mayo de 2012
0 votos
Yes. B1*2 + B2
2 comentarios
M
el 17 de Mayo de 2012
Walter Roberson
el 17 de Mayo de 2012
If you need to, put the 4 possible results into a vector, and index the vector at B1*2 + B2 + 1
Categorías
Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!