Converting decimal to binary with output data type 'double'

4 次查看(过去 30 天)
Hello, I am trying to convert decimal to binary.
I know that I need to use dec2bin; however, I want my binary number to be
a double instead of character.
Any idea how?
(The reason behind this is, because I will be implementing this in Simulink, which does not support char...)

回答(1 个)

Walter Roberson
Walter Roberson 2014-1-1
dec2bin(YourNumber, 8) - '0'
  4 个评论
Image Analyst
Image Analyst 2014-1-1
Mark as Accepted, so people like me don't need to open this discussion unnecessarily, and so Walter gets credit for helping you.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by