extract one of the bits in fi(), flip it, and reassemble it to produce new bin
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
scc28x
le 16 Avr 2021
Réponse apportée : Andy Bartlett
le 19 Avr 2021
Hi, I am trying to do the following cleanly in fixed point designer:
Take a binary: '0010'
Flip the 2nd bit to produce: '0000'
Is there a clean way to do this with some opeartion within fi(), perhaps just 1 or 2 lines of code?
I am a new user at fixed-point designer.
Thank you very much.
0 commentaires
Réponse acceptée
Plus de réponses (2)
Walter Roberson
le 19 Avr 2021
input = '1010';
input(3) = 'a' - input(3)
... It's magic ;-)
flipped = (1 - (x - '0')) + '0'
flipped = 1 + '0' + '0' - x
flipped = 1 + 48 + 48 - x
flipped = 97 - x
flipped = 'a' - x
0 commentaires
Voir également
Catégories
En savoir plus sur Fixed Point 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!