How to convert das decimal number to binary code and directly write into matrix columns?
Mostrar comentarios más antiguos
My Problem: Given is a vector filled with decimals. Accordingly, I would like to create a matrix by creating a for loop that gives me the binary code in a column for the respective decimal number 0-7. Number of decimals arent given
just like that:
D = [0 4 3 7 2 5 6 ...]
F = [0 1 0 1 0 1 1
0 0 1 1 1 0 1
0 0 1 1 0 1 0 ]
Thanks for your solutions. ;)
Respuestas (1)
D = [0 4 3 7 2 5 6 7]
F = dec2bin(D) % dec2bin
use dec2bin function
Categorías
Más información sobre Numeric Types 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!