Merge bits on a byte simulink

4 views (last 30 days)
Juan
Juan on 16 Jun 2022
Commented: Juan on 16 Jun 2022
Dears,
I would like to create a byte with 8 independent bits in Simulink. The opposite function is achieved with the "Extract Bits" block. From a byte I can extract the value of the bit at position x. I would like to do the opposite operation, from many bits to generate a byte.
Thanks and regards
Juan
  2 Comments
Juan
Juan on 16 Jun 2022
I thought there was a block that solved it. The second option is good.
Thank you!

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 16 Jun 2022
Edited: Fangjun Jiang on 16 Jun 2022
Drop 8 Constant blocks, each is specified as "true" or "false". Use a "Vector Concatenate" block to make it 8x1 vector, then feed it to a "Bit to Integer Converter" block.
"Mux" block can also be used to replace the "Vector Concatenate" block.
  1 Comment
Juan
Juan on 16 Jun 2022
Hi Fangjun, Bit to Integer Converter is the block I was looking for
Thank you!

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by