How can I make a decimal value of A multiplexed signal in Simulink?

3 ビュー (過去 30 日間)
Joonas
Joonas 2012 年 11 月 14 日
I have a multiplexed signal in a form like 10010100 which means that I have 8 separate boolean elements in one multiplexed message. However I would have to transform this to decimal form for next block in my model. The value should convert straight from 10010100 -> 148. I don´t find blocks for that operation?
Could someone help me to find the way for conversion?
Thank you!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 14 日
編集済み: Azzi Abdelmalek 2012 年 11 月 14 日
If you have a communication system toolbox, use a bit to integer converter block
If not use a bin2dec matlab function in a Interpreted matlab function block
  1 件のコメント
Joonas
Joonas 2012 年 11 月 14 日
Thank you Azzi, this was the most easy solution! Works fine!

サインインしてコメントする。

その他の回答 (3 件)

Matt J
Matt J 2012 年 11 月 14 日
>> bin2dec('10010100')
ans =
148

Matt J
Matt J 2012 年 11 月 14 日
>> [1 0 0 1 0 1 0 0 ]*(2.^(7:-1:0).')
ans =
148

Matt J
Matt J 2012 年 11 月 14 日
>> bin2dec( char([1 0 0 1 0 1 0 0]+'0') )
ans =
148

カテゴリ

Help Center および File ExchangeSignal Attributes and Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by