How to convert das decimal number to binary code and directly write into matrix columns?
Afficher commentaires plus anciens
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. ;)
Réponses (1)
D = [0 4 3 7 2 5 6 7]
F = dec2bin(D) % dec2bin
use dec2bin function
Catégories
En savoir plus sur Numeric Types dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!