Binary Bit Masking
36 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nevin
le 16 Nov 2011
Réponse apportée : Fangjun Jiang
le 17 Août 2018
What is the easiest way to bit mask a 16 bit binary value to decode different fields (2 bit, 4 bit, etc) with it? Thanks
0 commentaires
Réponse acceptée
Plus de réponses (2)
Walter Roberson
le 16 Nov 2011
You could use bitand() and bitshift() too. Or just bitget().
Watch out for the bit numbering order that MATLAB uses.
3 commentaires
thinnawat chumpuwiset
le 17 Août 2018
i'm still confuse about bitget(), can you describe more detail?
Fangjun Jiang
le 17 Août 2018
>> dec2bin(7,8)
ans =
'00000111'
>> bitget(7,1:8)
ans =
1 1 1 0 0 0 0 0
0 commentaires
Voir également
Catégories
En savoir plus sur Functions for Programming and Data Types dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!