How to combine two binary columns
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ennio Malvati
le 12 Oct 2022
Modifié(e) : Fangjun Jiang
le 12 Oct 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 commentaires
Réponse acceptée
Fangjun Jiang
le 12 Oct 2022
Modifié(e) : Fangjun Jiang
le 12 Oct 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!