フィルターのクリア

how can I convert negative signed floating values into binary ?

1 回表示 (過去 30 日間)
Sarfaraz Ahmed
Sarfaraz Ahmed 2018 年 10 月 29 日
編集済み: Sarfaraz Ahmed 2018 年 10 月 29 日
Hi. I designed ADC in simulink and now I want to convert final scalar values into binary (digital form). how can I convert these values into binary ? The values are like that : 1) -0.5 2)-30.5 3)-62.5 4)43.5 5)37.5
If i remove this fraction by doing this :
Dout=Dout+0.5; % Dout is final sampled scale value as I explained above
Dout_bin= dec2bin(typecast(int8(Dout),'uint8')); y = Dout_bin; then it shows an error how can I remove this error as well ?
Data 'y': Character outputs are not supported in Simulink and Stateflow. Cast 'y' to int8 or uint8 instead. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
is there any way in either script form or in simulink ? I attached my design. kindly help me in this regard.
Thanks
  2 件のコメント
Walter Roberson
Walter Roberson 2018 年 10 月 29 日
Subtract '0' from the output of dec2bin. Also be sure to specify width 8 for dec2bin.
Sarfaraz Ahmed
Sarfaraz Ahmed 2018 年 10 月 29 日
編集済み: Sarfaraz Ahmed 2018 年 10 月 29 日
Yes Sir, I found it . I was wrongly typing '0'. Thank you Sir.
can't I use Integer to bit converter block here ? I tried but it shows an error that " Error in port widths or dimensions. Output port 1 of 'ADC_ch2_DM/ADC1 ' is a matrix with a maximum size of [1x10000]
How can this error be fixed? I attach the design.
Thanks

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by