Converting decimal to binary with output data type 'double'

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...)

Respuestas (1)

dec2bin(YourNumber, 8) - '0'

4 comentarios

huh????? it works which is great but what is the logic behind this? Could you explain if you don't mind? thx
Oh I figured it out. Thx!
Mark as Accepted, so people like me don't need to open this discussion unnecessarily, and so Walter gets credit for helping you.
Thank you Mr. Walter!

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Preguntada:

el 1 de En. de 2014

Comentada:

el 5 de Dic. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by