How to combine two binary columns
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ennio Malvati
il 12 Ott 2022
Modificato: Fangjun Jiang
il 12 Ott 2022
I have a table like this: [0 1 0 0 1, 1 0 1 1 0]
and i want to combine binary the two columns in order to obtain a column like this:
[01, 10, 01, 01, 10]. Ho can I do this?
0 Commenti
Risposta accettata
Fangjun Jiang
il 12 Ott 2022
Modificato: Fangjun Jiang
il 12 Ott 2022
a=[0 1 0 0 1;1 0 1 1 0]
s=sprintf('%d%d\n',a(:))
Or
b=dec2bin(a)
c=reshape(b,2,[])
d=c'
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Types in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!