필터 지우기
필터 지우기

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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by