How to convert das decimal number to binary code and directly write into matrix columns?
Ältere Kommentare anzeigen
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. ;)
Antworten (1)
D = [0 4 3 7 2 5 6 7]
F = dec2bin(D) % dec2bin
use dec2bin function
Kategorien
Mehr zu Numeric Types finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!